402 references to EndpointProperty
Aspire.Hosting (53)
ApplicationModel\EndpointReference.cs (33)
116public ValueTask<string?> GetValueAsync(CancellationToken cancellationToken = default) => Property(EndpointProperty.Url).GetValueAsync(cancellationToken);
125public ValueTask<string?> GetValueAsync(ValueProviderContext context, CancellationToken cancellationToken = default) => Property(EndpointProperty.Url).GetValueAsync(context, cancellationToken);
137internal string GetExpression(EndpointProperty property = EndpointProperty.Url)
141EndpointProperty.Url => Binding("url"),
142EndpointProperty.Host or EndpointProperty.IPV4Host => Binding("host"),
143EndpointProperty.Port => Binding("port"),
144EndpointProperty.Scheme => Binding("scheme"),
145EndpointProperty.TargetPort => Binding("targetPort"),
146EndpointProperty.HostAndPort => $"{Binding("host")}:{Binding("port")}",
147EndpointProperty.TlsEnabled => Binding("tlsEnabled"),
157/// <param name="property">The <see cref="EndpointProperty"/> enum value to use in the reference.</param>
158/// <returns>An <see cref="EndpointReferenceExpression"/> representing the specified <see cref="EndpointProperty"/>.</returns>
160public EndpointReferenceExpression Property(EndpointProperty property)
184Property(EndpointProperty.TlsEnabled),
321public class EndpointReferenceExpression(EndpointReference endpointReference, EndpointProperty property) : IExpressionValue, IManifestExpressionProvider, IValueProvider, IValueWithReferences
329/// Gets the <see cref="EndpointProperty"/> for the property expression.
331public EndpointProperty Property { get; } = property;
343/// <returns>A <see cref="string"/> containing the selected <see cref="EndpointProperty"/> value.</returns>
344/// <exception cref="InvalidOperationException">Throws when the selected <see cref="EndpointProperty"/> enumeration is not known.</exception>
355/// <returns>A <see cref="string"/> containing the selected <see cref="EndpointProperty"/> value.</returns>
356/// <exception cref="InvalidOperationException">Throws when the selected <see cref="EndpointProperty"/> enumeration is not known.</exception>
365EndpointProperty.Scheme => new(Endpoint.Scheme),
366EndpointProperty.TlsEnabled => Endpoint.TlsEnabled ? bool.TrueString : bool.FalseString,
367EndpointProperty.IPV4Host when networkContext == KnownNetworkIdentifiers.LocalhostNetwork => "127.0.0.1",
368EndpointProperty.TargetPort when Endpoint.TargetPort is int port => new(port.ToString(CultureInfo.InvariantCulture)),
378EndpointProperty.Url => new(allocatedEndpoint.UriString),
379EndpointProperty.Host => new(allocatedEndpoint.Address),
380EndpointProperty.IPV4Host => new(allocatedEndpoint.Address),
381EndpointProperty.Port => new(allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)),
382EndpointProperty.TargetPort => new(ComputeTargetPort(allocatedEndpoint)),
383EndpointProperty.HostAndPort => new($"{allocatedEndpoint.Address}:{allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)}"),
Aspire.Hosting.Azure.AppConfiguration (1)
Aspire.Hosting.Azure.AppContainers (21)
BaseContainerAppContext.cs (11)
187private BicepValue<string> GetEndpointValue(EndpointMapping mapping, EndpointProperty property)
205EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: isHttpIngress ? null : $":{port}"),
206EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(),
207EndpointProperty.Port => port.ToString(CultureInfo.InvariantCulture),
208EndpointProperty.HostAndPort => GetHostValue(suffix: $":{port}"),
209EndpointProperty.TargetPort => targetPort is null ? AllocateContainerPortParameter() : $"{targetPort}",
210EndpointProperty.Scheme => scheme,
211EndpointProperty.TlsEnabled => tlsEnabled ? bool.TrueString : bool.FalseString,
240var url = GetEndpointValue(mapping, EndpointProperty.Url);
560Port = AsInt(GetEndpointValue(endpointMapping, EndpointProperty.TargetPort)),
Aspire.Hosting.Azure.AppService (21)
AzureAppServiceWebsiteContext.cs (11)
181(GetEndpointValue(context._slotEndpointMapping[ep.EndpointName], EndpointProperty.Url), secretType) :
182(GetEndpointValue(context._endpointMapping[ep.EndpointName], EndpointProperty.Url), secretType);
476var targetPort = GetEndpointValue(mapping, EndpointProperty.TargetPort);
863private BicepValue<string> GetEndpointValue(EndpointMapping mapping, EndpointProperty property)
867EndpointProperty.Url => BicepFunction.Interpolate($"{mapping.Scheme}://{mapping.Host}.azurewebsites.net"),
868EndpointProperty.Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
869EndpointProperty.Port => mapping.Port.ToString(CultureInfo.InvariantCulture),
870EndpointProperty.TargetPort => mapping.TargetPort?.ToString(CultureInfo.InvariantCulture) ?? (BicepValue<string>)AllocateParameter(new ContainerPortReference(Resource)),
871EndpointProperty.Scheme => mapping.Scheme,
872EndpointProperty.HostAndPort => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
873EndpointProperty.IPV4Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
Aspire.Hosting.Azure.CosmosDB (4)
Aspire.Hosting.Azure.EventHubs (5)
Aspire.Hosting.Azure.FrontDoor (1)
Aspire.Hosting.Azure.Functions (6)
Aspire.Hosting.Azure.KeyVault (2)
Aspire.Hosting.Azure.Kubernetes.Tests (1)
Aspire.Hosting.Azure.PostgreSQL (1)
Aspire.Hosting.Azure.Redis (2)
Aspire.Hosting.Azure.ServiceBus (4)
Aspire.Hosting.Azure.SignalR (2)
Aspire.Hosting.Azure.Sql (1)
Aspire.Hosting.Azure.Storage (6)
Aspire.Hosting.Azure.Tests (37)
AzureAppServiceTests.cs (10)
368.WithEnvironment("AGENT_URL", agent.GetEndpoint("http").Property(EndpointProperty.Url));
1129[InlineData(EndpointProperty.Url, "https://project1-website123.azurewebsites.net")]
1130[InlineData(EndpointProperty.Host, "project1-website123.azurewebsites.net")]
1131[InlineData(EndpointProperty.IPV4Host, "project1-website123.azurewebsites.net")]
1132[InlineData(EndpointProperty.Port, "443")]
1133[InlineData(EndpointProperty.TargetPort, "5000")]
1134[InlineData(EndpointProperty.Scheme, "https")]
1135[InlineData(EndpointProperty.HostAndPort, "project1-website123.azurewebsites.net")]
1136[InlineData(EndpointProperty.TlsEnabled, "True")]
1137public async Task GetEndpointPropertyExpression_ReturnsAppServiceEndpointPropertyExpression(EndpointProperty property, string expected)
AzureContainerAppsTests.cs (22)
150.WithEnvironment("AGENT_URL", agent.GetEndpoint("http").Property(EndpointProperty.Url));
369context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort);
370context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port);
371context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host);
372context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort);
373context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme);
374context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort);
446context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort);
447context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port);
448context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host);
449context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort);
450context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme);
451context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort);
2731[InlineData(EndpointProperty.Url, "https://project1.example.azurecontainerapps.io")]
2732[InlineData(EndpointProperty.Host, "project1.example.azurecontainerapps.io")]
2733[InlineData(EndpointProperty.IPV4Host, "project1.example.azurecontainerapps.io")]
2734[InlineData(EndpointProperty.Port, "443")]
2735[InlineData(EndpointProperty.TargetPort, "5000")]
2736[InlineData(EndpointProperty.Scheme, "https")]
2737[InlineData(EndpointProperty.HostAndPort, "project1.example.azurecontainerapps.io:443")]
2738[InlineData(EndpointProperty.TlsEnabled, "True")]
2739public async Task GetEndpointPropertyExpression_ReturnsContainerAppEndpointPropertyExpression(EndpointProperty property, string expected)
Aspire.Hosting.DevTunnels (4)
Aspire.Hosting.Docker (9)
Aspire.Hosting.Docker.Tests (2)
Aspire.Hosting.Foundry (6)
Aspire.Hosting.Garnet (3)
Aspire.Hosting.JavaScript (2)
Aspire.Hosting.Kafka (10)
Aspire.Hosting.Keycloak (1)
Aspire.Hosting.Kubernetes (13)
KubernetesResource.cs (12)
343Port = GetEndpointValue(endpointMapping, EndpointProperty.TargetPort),
541var url = GetEndpointValue(mapping, EndpointProperty.Url);
584var val = GetEndpointValue(mapping, epExpr.Property, embedded && epExpr.Property is EndpointProperty.Port or EndpointProperty.TargetPort);
747private static string GetEndpointValue(EndpointMapping mapping, EndpointProperty property, bool embedded = false)
762EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: GetPortSuffix(servicePort)),
763EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(),
764EndpointProperty.Port => GetPort(servicePort),
765EndpointProperty.HostAndPort => GetHostValue(suffix: GetPortSuffix(servicePort)),
766EndpointProperty.TargetPort => GetPort(targetPort),
767EndpointProperty.Scheme => scheme,
Aspire.Hosting.Milvus (3)
Aspire.Hosting.MongoDB (3)
Aspire.Hosting.MySql (4)
Aspire.Hosting.Nats (3)
Aspire.Hosting.Oracle (3)
Aspire.Hosting.PostgreSQL (4)
Aspire.Hosting.Python (1)
Aspire.Hosting.Qdrant (8)
Aspire.Hosting.RabbitMQ (3)
Aspire.Hosting.Radius (10)
Aspire.Hosting.Radius.Tests (8)
Aspire.Hosting.Redis (7)
Aspire.Hosting.Seq (4)
Aspire.Hosting.SqlServer (4)
Aspire.Hosting.Tests (103)
ComputeEnvironmentEndpointResolverTests.cs (6)
24endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
63endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
82endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
99endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
122endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out var expression);
146endpoint.Property(EndpointProperty.Url), [currentEnv.Resource], out _));
Dcp\DcpExecutorTests.cs (18)
376.WithArgs(c => c.Args.Add(endpoint.Property(EndpointProperty.Port)));
416c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port));
3807Assert.Equal(allocatedPort.ToString(CultureInfo.InvariantCulture), await database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port).GetValueAsync());
3823database.WithEnvironment("PUBLIC_PORT", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port));
3824database.WithEnvironment("PUBLIC_PORT_AGAIN", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port));
3871database.WithEnvironment("PUBLIC_HOST_AND_PORT", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.HostAndPort));
8831.WithEnvironment("EXE_PROXIED_PORT", executable.GetEndpoint("proxied").Property(EndpointProperty.Port))
8832.WithEnvironment("EXE_NOTPROXIED_PORT", executable.GetEndpoint("notProxied").Property(EndpointProperty.Port));
8838.WithEnvironment("EXE_PROXIED_PORT", executable.GetEndpoint("proxied").Property(EndpointProperty.Port))
8839.WithEnvironment("EXE_NOTPROXIED_PORT", executable.GetEndpoint("notProxied").Property(EndpointProperty.Port));
9017c.EnvironmentVariables["EXEC_PORT"] = executable.GetEndpoint("http").Property(EndpointProperty.Port);
9052c.EnvironmentVariables["EXEC_PORT"] = executable.GetEndpoint("http").Property(EndpointProperty.Port);
9093c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port));
9329c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port));
9366.WithEnvironment("EXEC_PORT", executable.GetEndpoint("http").Property(EndpointProperty.Port));
9401.WithEnvironment("EXEC_A_PORT", executableA.GetEndpoint("http").Property(EndpointProperty.Port));
9407.WithEnvironment("EXEC_B_PORT", executableB.GetEndpoint("http").Property(EndpointProperty.Port))
9464.WithEnvironment("UPSTREAM_PORT", upstreamExecutable.GetEndpoint("http").Property(EndpointProperty.Port))
EndpointReferenceTests.cs (37)
38var endpointExpr = endpointRef.Property(EndpointProperty.Url);
58var endpointExpr = endpointRef.Property(EndpointProperty.Url);
72var hostExpr = endpointRef.Property(EndpointProperty.Host);
91var portExpr = endpointRef.Property(EndpointProperty.Port);
110var schemeExpr = endpointRef.Property(EndpointProperty.Scheme);
124var ipv4Expr = endpointRef.Property(EndpointProperty.IPV4Host);
138var targetPortExpr = endpointRef.Property(EndpointProperty.TargetPort);
152var targetPortExpr = endpointRef.Property(EndpointProperty.TargetPort);
171var endpointExpr = endpointRef.Property(EndpointProperty.Url);
189var expr1 = endpointRef.Property(EndpointProperty.Url);
190var expr2 = endpointRef.Property(EndpointProperty.Host);
191var expr3 = endpointRef.Property(EndpointProperty.Port);
306[InlineData(EndpointProperty.Url, ResourceKind.Host, ResourceKind.Host, "blah://localhost:1234")]
307[InlineData(EndpointProperty.Url, ResourceKind.Host, ResourceKind.Container, "blah://localhost:1234")]
308[InlineData(EndpointProperty.Url, ResourceKind.Container, ResourceKind.Host, "blah://host.docker.internal:1234")]
309[InlineData(EndpointProperty.Url, ResourceKind.Container, ResourceKind.Container, "blah://destination.dev.internal:4567")]
310[InlineData(EndpointProperty.Host, ResourceKind.Host, ResourceKind.Host, "localhost")]
311[InlineData(EndpointProperty.Host, ResourceKind.Host, ResourceKind.Container, "localhost")]
312[InlineData(EndpointProperty.Host, ResourceKind.Container, ResourceKind.Host, "host.docker.internal")]
313[InlineData(EndpointProperty.Host, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal")]
314[InlineData(EndpointProperty.IPV4Host, ResourceKind.Host, ResourceKind.Host, "127.0.0.1")]
315[InlineData(EndpointProperty.IPV4Host, ResourceKind.Host, ResourceKind.Container, "127.0.0.1")]
316[InlineData(EndpointProperty.IPV4Host, ResourceKind.Container, ResourceKind.Host, "host.docker.internal")]
317[InlineData(EndpointProperty.IPV4Host, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal")]
318[InlineData(EndpointProperty.Port, ResourceKind.Host, ResourceKind.Host, "1234")]
319[InlineData(EndpointProperty.Port, ResourceKind.Host, ResourceKind.Container, "1234")]
320[InlineData(EndpointProperty.Port, ResourceKind.Container, ResourceKind.Host, "1234")]
321[InlineData(EndpointProperty.Port, ResourceKind.Container, ResourceKind.Container, "4567")]
322[InlineData(EndpointProperty.Scheme, ResourceKind.Host, ResourceKind.Host, "blah")]
323[InlineData(EndpointProperty.Scheme, ResourceKind.Host, ResourceKind.Container, "blah")]
324[InlineData(EndpointProperty.Scheme, ResourceKind.Container, ResourceKind.Host, "blah")]
325[InlineData(EndpointProperty.Scheme, ResourceKind.Container, ResourceKind.Container, "blah")]
326[InlineData(EndpointProperty.HostAndPort, ResourceKind.Host, ResourceKind.Host, "localhost:1234")]
327[InlineData(EndpointProperty.HostAndPort, ResourceKind.Host, ResourceKind.Container, "localhost:1234")]
328[InlineData(EndpointProperty.HostAndPort, ResourceKind.Container, ResourceKind.Host, "host.docker.internal:1234")]
329[InlineData(EndpointProperty.HostAndPort, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal:4567")]
330public async Task PropertyResolutionTest(EndpointProperty property, ResourceKind sourceKind, ResourceKind destinationKind, object expectedResult)
ExpressionResolverTests.cs (19)
327ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}");
351{ "TwoFullEndpoints", ReferenceExpression.Create($"Test1={Endpoint1.Property(EndpointProperty.Scheme)}://{Endpoint1.Property(EndpointProperty.IPV4Host)}:{Endpoint1.Property(EndpointProperty.Port)}/;Test2={Endpoint2.Property(EndpointProperty.Scheme)}://{Endpoint2.Property(EndpointProperty.Host)}:{Endpoint2.Property(EndpointProperty.Port)}/;") },
352{ "Url", ReferenceExpression.Create($"Url={Endpoint1.Property(EndpointProperty.Url)};") },
354{ "OnlyHost", ReferenceExpression.Create($"Host={Endpoint1.Property(EndpointProperty.Host)};") },
355{ "OnlyPort", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};") },
356{ "HostAndPort", ReferenceExpression.Create($"HostPort={Endpoint1.Property(EndpointProperty.HostAndPort)}") },
357{ "PortBeforeHost", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};Host={Endpoint1.Property(EndpointProperty.Host)};") },
358{ "FullAndPartial", ReferenceExpression.Create($"Test1={Endpoint1.Property(EndpointProperty.Scheme)}://{Endpoint1.Property(EndpointProperty.IPV4Host)}:{Endpoint1.Property(EndpointProperty.Port)}/;Test2={Endpoint2.Property(EndpointProperty.Scheme)}://localhost:{Endpoint2.Property(EndpointProperty.Port)}/;") },
363{ "UrlEncodedHost", ReferenceExpression.Create($"Host={Endpoint3.Property(EndpointProperty.Host):uri};") },
Aspire.Hosting.Valkey (3)
Aspire.Hosting.Yarp (5)
AspireWithNode.AppHost (1)
Stress.AppHost (7)