165 references to EndpointProperty
Aspire.Hosting (49)
ApplicationModel\EndpointReference.cs (24)
49internal string GetExpression(EndpointProperty property = EndpointProperty.Url) 53EndpointProperty.Url => Binding("url"), 54EndpointProperty.Host or EndpointProperty.IPV4Host => Binding("host"), 55EndpointProperty.Port => Binding("port"), 56EndpointProperty.Scheme => Binding("scheme"), 57EndpointProperty.TargetPort => Binding("targetPort"), 58EndpointProperty.HostAndPort => $"{Binding("host")}:{Binding("port")}", 68/// <param name="property">The <see cref="EndpointProperty"/> enum value to use in the reference.</param> 69/// <returns>An <see cref="EndpointReferenceExpression"/> representing the specified <see cref="EndpointProperty"/>.</returns> 70public EndpointReferenceExpression Property(EndpointProperty property) 149public class EndpointReferenceExpression(EndpointReference endpointReference, EndpointProperty property) : IManifestExpressionProvider, IValueProvider, IValueWithReferences 157/// Gets the <see cref="EndpointProperty"/> for the property expression. 159public EndpointProperty Property { get; } = property; 171/// <returns>A <see cref="string"/> containing the selected <see cref="EndpointProperty"/> value.</returns> 172/// <exception cref="InvalidOperationException">Throws when the selected <see cref="EndpointProperty"/> enumeration is not known.</exception> 175EndpointProperty.Url => new(Endpoint.Url), 176EndpointProperty.Host => new(Endpoint.Host), 177EndpointProperty.IPV4Host => new("127.0.0.1"), 178EndpointProperty.Port => new(Endpoint.Port.ToString(CultureInfo.InvariantCulture)), 179EndpointProperty.Scheme => new(Endpoint.Scheme), 180EndpointProperty.TargetPort => new(ComputeTargetPort()), 181EndpointProperty.HostAndPort => new($"{Endpoint.Host}:{Endpoint.Port.ToString(CultureInfo.InvariantCulture)}"),
ApplicationModel\ExpressionResolver.cs (19)
25async Task<string?> EvalEndpointAsync(EndpointReference endpointReference, EndpointProperty property) 39if (property is EndpointProperty.Host or EndpointProperty.IPV4Host) 43else if (property == EndpointProperty.Port) 47else if (property is EndpointProperty.Url or EndpointProperty.HostAndPort) 66(EndpointProperty.Host or EndpointProperty.IPV4Host, true, true) => target.Name, 67(EndpointProperty.Port, true, true) => await endpointReference.Property(EndpointProperty.TargetPort).GetValueAsync(cancellationToken).ConfigureAwait(false), 69(EndpointProperty.Host or EndpointProperty.IPV4Host, false, _) => containerHostName, 70(EndpointProperty.Url, _, _) => string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}", 72await EvalEndpointAsync(endpointReference, EndpointProperty.Host).ConfigureAwait(false), 73await EvalEndpointAsync(endpointReference, EndpointProperty.Port).ConfigureAwait(false)), 74(EndpointProperty.HostAndPort, _, _) => string.Format(CultureInfo.InvariantCulture, "{0}:{1}", 75await EvalEndpointAsync(endpointReference, EndpointProperty.Host).ConfigureAwait(false), 76await EvalEndpointAsync(endpointReference, EndpointProperty.Port).ConfigureAwait(false)), 181EndpointReference endpointReference when sourceIsContainer => new ResolvedValue(await EvalEndpointAsync(endpointReference, EndpointProperty.Url).ConfigureAwait(false), false),
ProjectResourceBuilderExtensions.cs (5)
757context.EnvironmentVariables["ASPNETCORE_HTTPS_PORT"] = e.Property(EndpointProperty.Port); 765aspnetCoreUrls.Append($"{e.Property(EndpointProperty.Scheme)}://{targetHost}:{e.Property(EndpointProperty.TargetPort)}"); 810ports.Append($"{e.Property(EndpointProperty.TargetPort)}"); 842var url = ReferenceExpression.Create($"{e.EndpointAnnotation.UriScheme}://{host}:{e.Property(EndpointProperty.TargetPort)}");
ResourceBuilderExtensions.cs (1)
599context.EnvironmentVariables[env] = endpointReference.Property(EndpointProperty.TargetPort);
Aspire.Hosting.Azure.AppContainers (9)
ContainerAppContext.cs (9)
455private BicepValue<string> GetValue(EndpointMapping mapping, EndpointProperty property) 473EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: isHttpIngress ? null : $":{port}"), 474EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 475EndpointProperty.Port => port.ToString(CultureInfo.InvariantCulture), 476EndpointProperty.HostAndPort => GetHostValue(suffix: $":{port}"), 477EndpointProperty.TargetPort => targetPort is null ? AllocateContainerPortParameter() : $"{targetPort}", 478EndpointProperty.Scheme => scheme, 498var url = GetValue(mapping, EndpointProperty.Url);
Aspire.Hosting.Azure.AppService (9)
AzureAppServiceWebsiteContext.cs (9)
118return (GetValue(context._endpointMapping[ep.EndpointName], EndpointProperty.Url), secretType); 320private BicepValue<string> GetValue(EndpointMapping mapping, EndpointProperty property) 324EndpointProperty.Url => BicepFunction.Interpolate($"{mapping.Scheme}://{mapping.Host}.azurewebsites.net"), 325EndpointProperty.Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"), 326EndpointProperty.Port => mapping.Port.ToString(CultureInfo.InvariantCulture), 327EndpointProperty.TargetPort => mapping.TargetPort?.ToString(CultureInfo.InvariantCulture) ?? (BicepValue<string>)AllocateParameter(new ContainerPortReference(Resource)), 328EndpointProperty.Scheme => mapping.Scheme, 329EndpointProperty.HostAndPort => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"), 330EndpointProperty.IPV4Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
Aspire.Hosting.Azure.CosmosDB (3)
AzureCosmosDBEmulatorConnectionString.cs (3)
13? ReferenceExpression.Create($"AccountKey={CosmosConstants.EmulatorAccountKey};AccountEndpoint={endpoint.Property(EndpointProperty.Url)}") 14: ReferenceExpression.Create($"AccountKey={CosmosConstants.EmulatorAccountKey};AccountEndpoint=https://{endpoint.Property(EndpointProperty.IPV4Host)}:{endpoint.Property(EndpointProperty.Port)};DisableServerCertificateValidation=True;");
Aspire.Hosting.Azure.EventHubs (1)
AzureEventHubsResource.cs (1)
59builder.Append($"Endpoint=sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true");
Aspire.Hosting.Azure.Functions (2)
AzureFunctionsProjectResourceExtensions.cs (2)
109context.EnvironmentVariables["ASPNETCORE_URLS"] = ReferenceExpression.Create($"http://+:{endpoint.Property(EndpointProperty.TargetPort)}"); 196context.Args.Add(targetEndpoint.Property(EndpointProperty.TargetPort));
Aspire.Hosting.Azure.ServiceBus (1)
AzureServiceBusResource.cs (1)
43? ReferenceExpression.Create($"Endpoint=sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;")
Aspire.Hosting.Azure.SignalR (1)
AzureSignalRResource.cs (1)
40? ReferenceExpression.Create($"Endpoint={EmulatorEndpoint.Property(EndpointProperty.Url)};AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGH;Version=1.0;")
Aspire.Hosting.Azure.Storage (3)
AzureStorageEmulatorConnectionString.cs (3)
35builder.Append($"{key}={endpoint.Property(EndpointProperty.Scheme)}://{endpoint.Property(EndpointProperty.IPV4Host)}:{endpoint.Property(EndpointProperty.Port)}/devstoreaccount1;");
Aspire.Hosting.Azure.Tests (16)
AzureContainerAppsTests.cs (12)
307context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort); 308context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port); 309context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host); 310context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort); 311context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme); 312context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort); 384context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort); 385context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port); 386context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host); 387context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort); 388context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme); 389context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort);
AzureProvisioningResourceExtensionsTests.cs (1)
21var referenceExpression = ReferenceExpression.Create($"prefix:{endpointReference.Property(EndpointProperty.HostAndPort)}");
src\Aspire.Hosting.Azure.Storage\AzureStorageEmulatorConnectionString.cs (3)
35builder.Append($"{key}={endpoint.Property(EndpointProperty.Scheme)}://{endpoint.Property(EndpointProperty.IPV4Host)}:{endpoint.Property(EndpointProperty.Port)}/devstoreaccount1;");
Aspire.Hosting.Docker (9)
DockerComposeServiceResourceExtensions.cs (9)
26var url = GetValue(mapping, EndpointProperty.Url); 88private static string GetValue(DockerComposeServiceResource.EndpointMapping mapping, EndpointProperty property) 92EndpointProperty.Url => GetHostValue($"{mapping.Scheme}://", $":{mapping.InternalPort}"), 93EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 94EndpointProperty.Port => mapping.InternalPort, 95EndpointProperty.HostAndPort => GetHostValue(suffix: $":{mapping.InternalPort}"), 96EndpointProperty.TargetPort => $"{mapping.InternalPort}", 97EndpointProperty.Scheme => mapping.Scheme,
Aspire.Hosting.Docker.Tests (2)
DockerComposePublisherTests.cs (2)
65context.EnvironmentVariables["TP"] = resource.GetEndpoint("http").Property(EndpointProperty.TargetPort); 66context.EnvironmentVariables["TPH2"] = resource.GetEndpoint("h2").Property(EndpointProperty.TargetPort);
Aspire.Hosting.Garnet (1)
GarnetResource.cs (1)
55builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Kafka (8)
KafkaBuilderExtensions.cs (7)
142? ReferenceExpression.Create($"{endpoint.Resource.Name}:{endpoint.Property(EndpointProperty.TargetPort)}") 143: ReferenceExpression.Create($"{endpoint.Property(EndpointProperty.HostAndPort)}"); 220? ReferenceExpression.Create($"PLAINTEXT://localhost:29092,PLAINTEXT_HOST://localhost:{primaryEndpoint.Property(EndpointProperty.Port)},PLAINTEXT_INTERNAL://{resource.Name}:{internalEndpoint.Property(EndpointProperty.TargetPort)}") 221: ReferenceExpression.Create($"PLAINTEXT://{primaryEndpoint.Property(EndpointProperty.Host)}:29092,PLAINTEXT_HOST://{primaryEndpoint.Property(EndpointProperty.HostAndPort)},PLAINTEXT_INTERNAL://{internalEndpoint.Property(EndpointProperty.HostAndPort)}");
KafkaServerResource.cs (1)
38ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Kubernetes (9)
KubernetesServiceResourceExtensions.cs (9)
30var url = GetEndpointValue(mapping, EndpointProperty.Url); 96private static string GetEndpointValue(EndpointMapping mapping, EndpointProperty property) 102EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: $":{port}"), 103EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 104EndpointProperty.Port => port, 105EndpointProperty.HostAndPort => GetHostValue(suffix: $":{port}"), 106EndpointProperty.TargetPort => port, 107EndpointProperty.Scheme => scheme,
Aspire.Hosting.Milvus (1)
MilvusServerResource.cs (1)
43$"Endpoint={PrimaryEndpoint.Property(EndpointProperty.Url)};Key=root:{ApiKeyParameter}");
Aspire.Hosting.MongoDB (1)
MongoDBServerResource.cs (1)
66builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.MySql (2)
MySqlServerResource.cs (2)
44$"Server={PrimaryEndpoint.Property(EndpointProperty.Host)};Port={PrimaryEndpoint.Property(EndpointProperty.Port)};User ID=root;Password={PasswordParameter}");
Aspire.Hosting.Nats (1)
NatsServerResource.cs (1)
65builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Oracle (1)
OracleDatabaseServerResource.cs (1)
41$"user id=system;password={PasswordParameter};data source={PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.PostgreSQL (2)
PostgresServerResource.cs (2)
51$"Host={PrimaryEndpoint.Property(EndpointProperty.Host)};Port={PrimaryEndpoint.Property(EndpointProperty.Port)};Username={UserNameReference};Password={PasswordParameter}");
Aspire.Hosting.Qdrant (2)
QdrantServerResource.cs (2)
48$"Endpoint={PrimaryEndpoint.Property(EndpointProperty.Url)};Key={ApiKeyParameter}"); 55$"Endpoint={HttpEndpoint.Property(EndpointProperty.Url)};Key={ApiKeyParameter}");
Aspire.Hosting.RabbitMQ (1)
RabbitMQServerResource.cs (1)
55$"amqp://{UserNameReference}:{PasswordParameter}@{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Redis (1)
RedisResource.cs (1)
42builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Seq (1)
SeqResource.cs (1)
25ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}");
Aspire.Hosting.SqlServer (2)
SqlServerServerResource.cs (2)
38$"Server={PrimaryEndpoint.Property(EndpointProperty.IPV4Host)},{PrimaryEndpoint.Property(EndpointProperty.Port)};User ID=sa;Password={PasswordParameter};TrustServerCertificate=true");
Aspire.Hosting.Tests (23)
ExpressionResolverTests.cs (18)
200ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}"); 223{ "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)}/;") }, 224{ "Url", ReferenceExpression.Create($"Url={Endpoint1.Property(EndpointProperty.Url)};") }, 226{ "OnlyHost", ReferenceExpression.Create($"Host={Endpoint1.Property(EndpointProperty.Host)};") }, 227{ "OnlyPort", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};") }, 228{ "HostAndPort", ReferenceExpression.Create($"HostPort={Endpoint1.Property(EndpointProperty.HostAndPort)}") }, 229{ "PortBeforeHost", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};Host={Endpoint1.Property(EndpointProperty.Host)};") }, 230{ "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)}/;") },
WithEnvironmentTests.cs (5)
237.WithEnvironment("PORT", $"{endpoint.Property(EndpointProperty.Port)}") 238.WithEnvironment("TARGET_PORT", $"{endpoint.Property(EndpointProperty.TargetPort)}") 285.WithEnvironment("URL", $"{endpoint.Property(EndpointProperty.Host)}:{endpoint.Property(EndpointProperty.Port)}"); 311.WithEnvironment("TARGET_PORT", $"{endpoint.Property(EndpointProperty.TargetPort)}");
Aspire.Hosting.Valkey (1)
ValkeyResource.cs (1)
55builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Stress.AppHost (3)
Program.cs (3)
36.WithEnvironment("HOST", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Host)}") 37.WithEnvironment("PORT", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Port)}") 38.WithEnvironment("URL", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Url)}");