185 references to EndpointProperty
Aspire.Hosting (50)
ApplicationModel\EndpointReference.cs (26)
58
public ValueTask<string?> GetValueAsync(CancellationToken cancellationToken = default) => Property(
EndpointProperty
.Url).GetValueAsync(cancellationToken);
63
internal string GetExpression(
EndpointProperty
property =
EndpointProperty
.Url)
67
EndpointProperty
.Url => Binding("url"),
68
EndpointProperty
.Host or
EndpointProperty
.IPV4Host => Binding("host"),
69
EndpointProperty
.Port => Binding("port"),
70
EndpointProperty
.Scheme => Binding("scheme"),
71
EndpointProperty
.TargetPort => Binding("targetPort"),
72
EndpointProperty
.HostAndPort => $"{Binding("host")}:{Binding("port")}",
82
/// <param name="property">The <see cref="
EndpointProperty
"/> enum value to use in the reference.</param>
83
/// <returns>An <see cref="EndpointReferenceExpression"/> representing the specified <see cref="
EndpointProperty
"/>.</returns>
84
public EndpointReferenceExpression Property(
EndpointProperty
property)
166
public class EndpointReferenceExpression(EndpointReference endpointReference,
EndpointProperty
property) : IManifestExpressionProvider, IValueProvider, IValueWithReferences
174
/// Gets the <see cref="
EndpointProperty
"/> for the property expression.
176
public
EndpointProperty
Property { get; } = property;
188
/// <returns>A <see cref="string"/> containing the selected <see cref="
EndpointProperty
"/> value.</returns>
189
/// <exception cref="InvalidOperationException">Throws when the selected <see cref="
EndpointProperty
"/> enumeration is not known.</exception>
194
EndpointProperty
.Scheme => new(Endpoint.Scheme),
195
EndpointProperty
.IPV4Host => new("127.0.0.1"),
196
EndpointProperty
.TargetPort when Endpoint.TargetPort is int port => new(port.ToString(CultureInfo.InvariantCulture)),
206
EndpointProperty
.Url => new(allocatedEndpoint.UriString),
207
EndpointProperty
.Host => new(allocatedEndpoint.Address),
208
EndpointProperty
.Port => new(allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)),
209
EndpointProperty
.TargetPort => new(ComputeTargetPort(allocatedEndpoint)),
210
EndpointProperty
.HostAndPort => new($"{allocatedEndpoint.Address}:{allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)}"),
ApplicationModel\ExpressionResolver.cs (14)
11
async Task<string?> EvalEndpointAsync(EndpointReference endpointReference,
EndpointProperty
property)
20
(
EndpointProperty
.Host or
EndpointProperty
.IPV4Host, true) => target.Name,
21
(
EndpointProperty
.Port, true) => await endpointReference.Property(
EndpointProperty
.TargetPort).GetValueAsync(cancellationToken).ConfigureAwait(false),
23
(
EndpointProperty
.Host or
EndpointProperty
.IPV4Host, false) => containerHostName,
24
(
EndpointProperty
.Url, _) => string.Format(CultureInfo.InvariantCulture, "{0}://{1}:{2}",
26
await EvalEndpointAsync(endpointReference,
EndpointProperty
.Host).ConfigureAwait(false),
27
await EvalEndpointAsync(endpointReference,
EndpointProperty
.Port).ConfigureAwait(false)),
28
(
EndpointProperty
.HostAndPort, _) => string.Format(CultureInfo.InvariantCulture, "{0}:{1}",
29
await EvalEndpointAsync(endpointReference,
EndpointProperty
.Host).ConfigureAwait(false),
30
await EvalEndpointAsync(endpointReference,
EndpointProperty
.Port).ConfigureAwait(false)),
135
EndpointReference endpointReference when sourceIsContainer => new ResolvedValue(await EvalEndpointAsync(endpointReference,
EndpointProperty
.Url).ConfigureAwait(false), false),
Dashboard\DashboardEventHandlers.cs (4)
590
ReferenceExpression.Create($"{e.Property(
EndpointProperty
.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(
EndpointProperty
.TargetPort)}");
615
aspnetCoreUrls.Append($"{e.Property(
EndpointProperty
.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(
EndpointProperty
.TargetPort)}");
ProjectResourceBuilderExtensions.cs (5)
766
context.EnvironmentVariables["ASPNETCORE_HTTPS_PORT"] = e.Property(
EndpointProperty
.Port);
771
aspnetCoreUrls.Append($"{e.Property(
EndpointProperty
.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(
EndpointProperty
.TargetPort)}");
816
ports.Append($"{e.Property(
EndpointProperty
.TargetPort)}");
848
var url = ReferenceExpression.Create($"{e.EndpointAnnotation.UriScheme}://{host}:{e.Property(
EndpointProperty
.TargetPort)}");
ResourceBuilderExtensions.cs (1)
716
context.EnvironmentVariables[env] = endpointReference.Property(
EndpointProperty
.TargetPort);
Aspire.Hosting.Azure.AppConfiguration (1)
AzureAppConfigurationResource.cs (1)
41
? ReferenceExpression.Create($"Endpoint={EmulatorEndpoint.Property(
EndpointProperty
.Url)};Id=anonymous;Secret=abcdefghijklmnopqrstuvwxyz1234567890;Anonymous=True")
Aspire.Hosting.Azure.AppContainers (10)
BaseContainerAppContext.cs (10)
179
private BicepValue<string> GetEndpointValue(EndpointMapping mapping,
EndpointProperty
property)
197
EndpointProperty
.Url => GetHostValue($"{scheme}://", suffix: isHttpIngress ? null : $":{port}"),
198
EndpointProperty
.Host or
EndpointProperty
.IPV4Host => GetHostValue(),
199
EndpointProperty
.Port => port.ToString(CultureInfo.InvariantCulture),
200
EndpointProperty
.HostAndPort => GetHostValue(suffix: $":{port}"),
201
EndpointProperty
.TargetPort => targetPort is null ? AllocateContainerPortParameter() : $"{targetPort}",
202
EndpointProperty
.Scheme => scheme,
222
var url = GetEndpointValue(mapping,
EndpointProperty
.Url);
488
Port = AsInt(GetEndpointValue(endpointMapping,
EndpointProperty
.TargetPort)),
Aspire.Hosting.Azure.AppService (9)
AzureAppServiceWebsiteContext.cs (9)
120
return (GetEndpointValue(context._endpointMapping[ep.EndpointName],
EndpointProperty
.Url), secretType);
358
private BicepValue<string> GetEndpointValue(EndpointMapping mapping,
EndpointProperty
property)
362
EndpointProperty
.Url => BicepFunction.Interpolate($"{mapping.Scheme}://{mapping.Host}.azurewebsites.net"),
363
EndpointProperty
.Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
364
EndpointProperty
.Port => mapping.Port.ToString(CultureInfo.InvariantCulture),
365
EndpointProperty
.TargetPort => mapping.TargetPort?.ToString(CultureInfo.InvariantCulture) ?? (BicepValue<string>)AllocateParameter(new ContainerPortReference(Resource)),
366
EndpointProperty
.Scheme => mapping.Scheme,
367
EndpointProperty
.HostAndPort => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
368
EndpointProperty
.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)
59
builder.Append($"Endpoint=sb://{EmulatorEndpoint.Property(
EndpointProperty
.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true");
Aspire.Hosting.Azure.Functions (2)
AzureFunctionsProjectResourceExtensions.cs (2)
121
context.EnvironmentVariables["ASPNETCORE_URLS"] = ReferenceExpression.Create($"http://+:{endpoint.Property(
EndpointProperty
.TargetPort)}");
208
context.Args.Add(targetEndpoint.Property(
EndpointProperty
.TargetPort));
Aspire.Hosting.Azure.PostgreSQL (1)
AzurePostgresFlexibleServerResource.cs (1)
83
ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}") :
Aspire.Hosting.Azure.Redis (2)
AzureRedisCacheResource.cs (1)
78
ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}") :
AzureRedisEnterpriseResource.cs (1)
83
ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}") :
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)
35
builder.Append($"{key}={endpoint.Property(
EndpointProperty
.Scheme)}://{endpoint.Property(
EndpointProperty
.IPV4Host)}:{endpoint.Property(
EndpointProperty
.Port)}/devstoreaccount1;");
Aspire.Hosting.Azure.Tests (16)
AzureContainerAppsTests.cs (12)
308
context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(
EndpointProperty
.TargetPort);
309
context.EnvironmentVariables["PORT"] = httpEp.Property(
EndpointProperty
.Port);
310
context.EnvironmentVariables["HOST"] = httpEp.Property(
EndpointProperty
.Host);
311
context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(
EndpointProperty
.HostAndPort);
312
context.EnvironmentVariables["SCHEME"] = httpEp.Property(
EndpointProperty
.Scheme);
313
context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(
EndpointProperty
.HostAndPort);
385
context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(
EndpointProperty
.TargetPort);
386
context.EnvironmentVariables["PORT"] = httpEp.Property(
EndpointProperty
.Port);
387
context.EnvironmentVariables["HOST"] = httpEp.Property(
EndpointProperty
.Host);
388
context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(
EndpointProperty
.HostAndPort);
389
context.EnvironmentVariables["SCHEME"] = httpEp.Property(
EndpointProperty
.Scheme);
390
context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(
EndpointProperty
.HostAndPort);
AzureProvisioningResourceExtensionsTests.cs (1)
21
var referenceExpression = ReferenceExpression.Create($"prefix:{endpointReference.Property(
EndpointProperty
.HostAndPort)}");
src\Aspire.Hosting.Azure.Storage\AzureStorageEmulatorConnectionString.cs (3)
35
builder.Append($"{key}={endpoint.Property(
EndpointProperty
.Scheme)}://{endpoint.Property(
EndpointProperty
.IPV4Host)}:{endpoint.Property(
EndpointProperty
.Port)}/devstoreaccount1;");
Aspire.Hosting.Docker (9)
DockerComposeServiceResourceExtensions.cs (9)
26
var url = GetValue(mapping,
EndpointProperty
.Url);
88
private static string GetValue(DockerComposeServiceResource.EndpointMapping mapping,
EndpointProperty
property)
92
EndpointProperty
.Url => GetHostValue($"{mapping.Scheme}://", $":{mapping.InternalPort}"),
93
EndpointProperty
.Host or
EndpointProperty
.IPV4Host => GetHostValue(),
94
EndpointProperty
.Port => mapping.InternalPort,
95
EndpointProperty
.HostAndPort => GetHostValue(suffix: $":{mapping.InternalPort}"),
96
EndpointProperty
.TargetPort => $"{mapping.InternalPort}",
97
EndpointProperty
.Scheme => mapping.Scheme,
Aspire.Hosting.Docker.Tests (2)
DockerComposePublisherTests.cs (2)
65
context.EnvironmentVariables["TP"] = resource.GetEndpoint("http").Property(
EndpointProperty
.TargetPort);
66
context.EnvironmentVariables["TPH2"] = resource.GetEndpoint("h2").Property(
EndpointProperty
.TargetPort);
Aspire.Hosting.Garnet (1)
GarnetResource.cs (1)
55
builder.Append($"{PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}");
Aspire.Hosting.Kafka (7)
KafkaBuilderExtensions.cs (6)
140
? ReferenceExpression.Create($"{endpoint.Resource.Name}:{endpoint.Property(
EndpointProperty
.TargetPort)}")
141
: ReferenceExpression.Create($"{endpoint.Property(
EndpointProperty
.HostAndPort)}");
218
? ReferenceExpression.Create($"PLAINTEXT://localhost:29092,PLAINTEXT_HOST://localhost:{primaryEndpoint.Port.ToString(CultureInfo.InvariantCulture)},PLAINTEXT_INTERNAL://{resource.Name}:{internalEndpoint.Property(
EndpointProperty
.TargetPort)}")
219
: ReferenceExpression.Create($"PLAINTEXT://{primaryEndpoint.Property(
EndpointProperty
.Host)}:29092,PLAINTEXT_HOST://{primaryEndpoint.Property(
EndpointProperty
.HostAndPort)},PLAINTEXT_INTERNAL://{internalEndpoint.Property(
EndpointProperty
.HostAndPort)}");
KafkaServerResource.cs (1)
38
ReferenceExpression.Create($"{PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}");
Aspire.Hosting.Kubernetes (10)
KubernetesResource.cs (10)
248
Port = GetEndpointValue(endpointMapping,
EndpointProperty
.TargetPort),
374
var url = GetEndpointValue(mapping,
EndpointProperty
.Url);
440
private static string GetEndpointValue(EndpointMapping mapping,
EndpointProperty
property)
446
EndpointProperty
.Url => GetHostValue($"{scheme}://", suffix: $":{port}"),
447
EndpointProperty
.Host or
EndpointProperty
.IPV4Host => GetHostValue(),
448
EndpointProperty
.Port => port,
449
EndpointProperty
.HostAndPort => GetHostValue(suffix: $":{port}"),
450
EndpointProperty
.TargetPort => port,
451
EndpointProperty
.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)
66
builder.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)
65
builder.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)
57
$"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)
42
builder.Append($"{PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}");
Aspire.Hosting.Seq (1)
SeqResource.cs (1)
25
ReferenceExpression.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 (36)
EndpointReferenceTests.cs (12)
36
var endpointExpr = endpointRef.Property(
EndpointProperty
.Url);
56
var endpointExpr = endpointRef.Property(
EndpointProperty
.Url);
70
var hostExpr = endpointRef.Property(
EndpointProperty
.Host);
89
var portExpr = endpointRef.Property(
EndpointProperty
.Port);
108
var schemeExpr = endpointRef.Property(
EndpointProperty
.Scheme);
122
var ipv4Expr = endpointRef.Property(
EndpointProperty
.IPV4Host);
136
var targetPortExpr = endpointRef.Property(
EndpointProperty
.TargetPort);
150
var targetPortExpr = endpointRef.Property(
EndpointProperty
.TargetPort);
169
var endpointExpr = endpointRef.Property(
EndpointProperty
.Url);
187
var expr1 = endpointRef.Property(
EndpointProperty
.Url);
188
var expr2 = endpointRef.Property(
EndpointProperty
.Host);
189
var expr3 = endpointRef.Property(
EndpointProperty
.Port);
ExpressionResolverTests.cs (18)
199
ReferenceExpression.Create($"{PrimaryEndpoint.Property(
EndpointProperty
.Url)}");
222
{ "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)}/;") },
223
{ "Url", ReferenceExpression.Create($"Url={Endpoint1.Property(
EndpointProperty
.Url)};") },
225
{ "OnlyHost", ReferenceExpression.Create($"Host={Endpoint1.Property(
EndpointProperty
.Host)};") },
226
{ "OnlyPort", ReferenceExpression.Create($"Port={Endpoint1.Property(
EndpointProperty
.Port)};") },
227
{ "HostAndPort", ReferenceExpression.Create($"HostPort={Endpoint1.Property(
EndpointProperty
.HostAndPort)}") },
228
{ "PortBeforeHost", ReferenceExpression.Create($"Port={Endpoint1.Property(
EndpointProperty
.Port)};Host={Endpoint1.Property(
EndpointProperty
.Host)};") },
229
{ "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 (6)
236
.WithEnvironment("PORT", $"{endpoint.Property(
EndpointProperty
.Port)}")
237
.WithEnvironment("TARGET_PORT", $"{endpoint.Property(
EndpointProperty
.TargetPort)}")
284
.WithEnvironment("URL", $"{endpoint.Property(
EndpointProperty
.Host)}:{endpoint.Property(
EndpointProperty
.Port)}");
310
.WithEnvironment("TARGET_PORT", $"{endpoint.Property(
EndpointProperty
.TargetPort)}");
441
var portProperty = endpoint.Property(
EndpointProperty
.Port);
Aspire.Hosting.Valkey (1)
ValkeyResource.cs (1)
55
builder.Append($"{PrimaryEndpoint.Property(
EndpointProperty
.HostAndPort)}");
AspireWithNode.AppHost (1)
NodeHostingExtensions.cs (1)
26
context.EnvironmentVariables["HTTPS_REDIRECT_PORT"] = ReferenceExpression.Create($"{httpsEndpoint.Property(
EndpointProperty
.Port)}");
Stress.AppHost (3)
Program.cs (3)
44
.WithEnvironment("HOST", $"{serviceBuilder.GetEndpoint("http").Property(
EndpointProperty
.Host)}")
45
.WithEnvironment("PORT", $"{serviceBuilder.GetEndpoint("http").Property(
EndpointProperty
.Port)}")
46
.WithEnvironment("URL", $"{serviceBuilder.GetEndpoint("http").Property(
EndpointProperty
.Url)}");