680 references to EndpointProperty
Aspire.Hosting (65)
ApplicationModel\EndpointReference.cs (40)
71public EndpointReferenceExpression BrowserOrigins => Property(EndpointProperty.BrowserOrigins); 87public EndpointReferenceExpression PrimaryBrowserOrigin => Property(EndpointProperty.PrimaryBrowserOrigin); 149public ValueTask<string?> GetValueAsync(CancellationToken cancellationToken = default) => Property(EndpointProperty.Url).GetValueAsync(cancellationToken); 158public ValueTask<string?> GetValueAsync(ValueProviderContext context, CancellationToken cancellationToken = default) => Property(EndpointProperty.Url).GetValueAsync(context, cancellationToken); 170internal string GetExpression(EndpointProperty property = EndpointProperty.Url) 174EndpointProperty.Url => Binding("url"), 175EndpointProperty.Host or EndpointProperty.IPV4Host => Binding("host"), 176EndpointProperty.Port => Binding("port"), 177EndpointProperty.Scheme => Binding("scheme"), 178EndpointProperty.TargetPort => Binding("targetPort"), 179EndpointProperty.HostAndPort => $"{Binding("host")}:{Binding("port")}", 180EndpointProperty.TlsEnabled => Binding("tlsEnabled"), 181EndpointProperty.BrowserOrigins => Binding("browserOrigins"), 182EndpointProperty.PrimaryBrowserOrigin => Binding("primaryBrowserOrigin"), 192/// <param name="property">The <see cref="EndpointProperty"/> enum value to use in the reference.</param> 193/// <returns>An <see cref="EndpointReferenceExpression"/> representing the specified <see cref="EndpointProperty"/>.</returns> 195public EndpointReferenceExpression Property(EndpointProperty property) 219Property(EndpointProperty.TlsEnabled), 356public class EndpointReferenceExpression(EndpointReference endpointReference, EndpointProperty property) : IExpressionValue, IManifestExpressionProvider, IValueProvider, IValueWithReferences 364/// Gets the <see cref="EndpointProperty"/> for the property expression. 366public EndpointProperty Property { get; } = property; 378/// <returns>A <see cref="string"/> containing the selected <see cref="EndpointProperty"/> value.</returns> 379/// <exception cref="InvalidOperationException">Throws when the selected <see cref="EndpointProperty"/> enumeration is not known.</exception> 390/// <returns>A <see cref="string"/> containing the selected <see cref="EndpointProperty"/> value.</returns> 391/// <exception cref="InvalidOperationException">Throws when the selected <see cref="EndpointProperty"/> enumeration is not known.</exception> 400EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 402EndpointProperty.Scheme => new(Endpoint.Scheme), 403EndpointProperty.TlsEnabled => Endpoint.TlsEnabled ? bool.TrueString : bool.FalseString, 404EndpointProperty.IPV4Host when networkContext == KnownNetworkIdentifiers.LocalhostNetwork => "127.0.0.1", 405EndpointProperty.TargetPort when Endpoint.TargetPort is int port => new(port.ToString(CultureInfo.InvariantCulture)), 432return Property == EndpointProperty.PrimaryBrowserOrigin 443EndpointProperty.Url => new(allocatedEndpoint.UriString), 444EndpointProperty.Host => new(allocatedEndpoint.Address), 445EndpointProperty.IPV4Host => new(allocatedEndpoint.Address), 446EndpointProperty.Port => new(allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)), 447EndpointProperty.TargetPort => new(ComputeTargetPort(allocatedEndpoint)), 448EndpointProperty.HostAndPort => new($"{allocatedEndpoint.Address}:{allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)}"),
ApplicationModel\HostUrl.cs (1)
84var port = await targetEndpoint.Property(EndpointProperty.Port).GetValueAsync(context, cancellationToken).ConfigureAwait(false);
ApplicationModel\IComputeEnvironmentResource.cs (11)
46var property = endpointReferenceExpression.Property; 48if (property is EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin) 60EndpointProperty.Url => IsDefaultPort(scheme, port) 63EndpointProperty.Host or EndpointProperty.IPV4Host => host.Value, 64EndpointProperty.Port => ReferenceExpression.Create($"{port.ToString(CultureInfo.InvariantCulture)}"), 65EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort 68EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"), 69EndpointProperty.HostAndPort => ReferenceExpression.Create($"{host.Value}:{port.ToString(CultureInfo.InvariantCulture)}"), 70EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(endpoint.TlsEnabled ? bool.TrueString : bool.FalseString)}"),
Dashboard\DashboardEventHandlers.cs (4)
688ReferenceExpression.Create($"{e.Property(EndpointProperty.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(EndpointProperty.TargetPort)}"); 714aspnetCoreUrls.Append($"{e.Property(EndpointProperty.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(EndpointProperty.TargetPort)}");
ProjectResourceBuilderExtensions.cs (5)
1211context.EnvironmentVariables[KnownAspNetCoreConfigNames.HttpsPort] = e.Property(EndpointProperty.Port); 1216aspnetCoreUrls.Append($"{e.Property(EndpointProperty.Scheme)}://{e.EndpointAnnotation.TargetHost}:{e.Property(EndpointProperty.TargetPort)}"); 1263ports.Append($"{e.Property(EndpointProperty.TargetPort)}"); 1296var url = ReferenceExpression.Create($"{e.EndpointAnnotation.UriScheme}://{host}:{e.Property(EndpointProperty.TargetPort)}");
Publishing\ManifestPublishingContext.cs (3)
810EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 877else if (source is EndpointReferenceExpression { Property: EndpointProperty.TlsEnabled } endpointProperty)
ResourceBuilderExtensions.cs (1)
1984context.EnvironmentVariables[endpointAnnotation.TargetPortEnvironmentVariable!] = endpointReference.Property(EndpointProperty.TargetPort);
Aspire.Hosting.Azure.ApiManagement (3)
AzureApiManagementExtensions.cs (2)
2374endpoint.Property(EndpointProperty.Url)); 2448endpoint.Property(EndpointProperty.Url));
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.AppConfiguration (1)
AzureAppConfigurationResource.cs (1)
51? ReferenceExpression.Create($"Endpoint={EmulatorEndpoint.Property(EndpointProperty.Url)};Id=anonymous;Secret=abcdefghijklmnopqrstuvwxyz1234567890;Anonymous=True")
Aspire.Hosting.Azure.AppContainers (36)
AzureContainerAppEnvironmentResource.cs (15)
431var property = endpointReferenceExpression.Property; 433if (property is (EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin) && IsExpress) 437if (property is (EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin) && (!endpoint.IsExternal || endpoint.UriScheme is not ("http" or "https"))) 450EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 452EndpointProperty.Url => ReferenceExpression.Create($"{scheme}://{host}"), 453EndpointProperty.Host or EndpointProperty.IPV4Host => host, 454EndpointProperty.Port => ReferenceExpression.Create($"{port.ToString(CultureInfo.InvariantCulture)}"), 455EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort 458EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"), 459EndpointProperty.HostAndPort => ReferenceExpression.Create($"{host}:{port.ToString(CultureInfo.InvariantCulture)}"), 460EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(tlsEnabled ? bool.TrueString : bool.FalseString)}"),
BaseContainerAppContext.cs (20)
205EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin when isHttpIngress && external => 207EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 211EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: isHttpIngress ? null : $":{port}"), 212EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 213EndpointProperty.Port => port.ToString(CultureInfo.InvariantCulture), 214EndpointProperty.HostAndPort => GetHostValue(suffix: $":{port}"), 215EndpointProperty.TargetPort => targetPort is null ? AllocateContainerPortParameter() : $"{targetPort}", 216EndpointProperty.Scheme => scheme, 217EndpointProperty.TlsEnabled => tlsEnabled ? bool.TrueString : bool.FalseString, 261var url = GetEndpointValue(mapping, ep.Property(EndpointProperty.Url)); 322if (epExpr.Property is EndpointProperty.Url or EndpointProperty.Host or EndpointProperty.IPV4Host or EndpointProperty.HostAndPort or 323EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin) 595Port = AsInt(GetEndpointValue(endpointMapping, endpointProbeAnnotation.EndpointReference.Property(EndpointProperty.TargetPort))),
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.AppService (29)
AzureAppServiceEnvironmentResource.cs (13)
563var property = endpointReferenceExpression.Property; 565if (property is (EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin) && (!endpoint.IsExternal || endpoint.UriScheme is not ("http" or "https"))) 578EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 580EndpointProperty.Url => ReferenceExpression.Create($"{scheme}://{host}"), 581EndpointProperty.Host or EndpointProperty.IPV4Host => host, 582EndpointProperty.Port => ReferenceExpression.Create($"{port.ToString(CultureInfo.InvariantCulture)}"), 583EndpointProperty.TargetPort => endpoint.TargetPort is int targetPort 586EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"), 587EndpointProperty.HostAndPort => host, 588EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(tlsEnabled ? bool.TrueString : bool.FalseString)}"),
AzureAppServiceWebsiteContext.cs (15)
215(GetEndpointValue(context._slotEndpointMapping[ep.EndpointName], EndpointProperty.Url), secretType) : 216(GetEndpointValue(context._endpointMapping[ep.EndpointName], EndpointProperty.Url), secretType); 528var targetPort = GetEndpointValue(mapping, EndpointProperty.TargetPort); 936private BicepValue<string> GetEndpointValue(EndpointMapping mapping, EndpointProperty property) 940EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin when mapping.IsHttpIngress && mapping.External => 942EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 946EndpointProperty.Url => BicepFunction.Interpolate($"{mapping.Scheme}://{mapping.Host}.azurewebsites.net"), 947EndpointProperty.Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"), 948EndpointProperty.Port => mapping.Port.ToString(CultureInfo.InvariantCulture), 949EndpointProperty.TargetPort => mapping.TargetPort?.ToString(CultureInfo.InvariantCulture) ?? (BicepValue<string>)AllocateParameter(new ContainerPortReference(Resource)), 950EndpointProperty.Scheme => mapping.Scheme, 951EndpointProperty.HostAndPort => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"), 952EndpointProperty.IPV4Host => BicepFunction.Interpolate($"{mapping.Host}.azurewebsites.net"),
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.CosmosDB (4)
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;");
AzureCosmosDBResource.cs (1)
110ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Url)}") :
Aspire.Hosting.Azure.EntraId (3)
EntraIdResourceExtensions.cs (1)
1555var tlsEnabled = computeEnvironment.GetEndpointPropertyExpression(endpoint.Property(EndpointProperty.TlsEnabled));
EntraIdRunModeBrowserOrigin.cs (1)
33var allocatedUrl = await endpoint.Property(EndpointProperty.Url).GetValueAsync(context, cancellationToken).ConfigureAwait(false);
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.EntraId.Tests (2)
EntraIdProvisioningTests.cs (2)
1565if (endpointReferenceExpression.Property is EndpointProperty.TlsEnabled) 1570Assert.Equal(EndpointProperty.PrimaryBrowserOrigin, endpointReferenceExpression.Property);
Aspire.Hosting.Azure.EventHubs (5)
AzureEventHubsResource.cs (5)
69ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Host)}") : 81ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Port)}") : 92ReferenceExpression.Create($"sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)}") : 106builder.Append($"Endpoint=sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true"); 216yield return new("ConnectionString", ReferenceExpression.Create($"Endpoint={EmulatorEndpoint.Property(EndpointProperty.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true"));
Aspire.Hosting.Azure.FrontDoor (1)
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.Functions (7)
AzureFunctionsProjectResourceExtensions.cs (3)
273context.EnvironmentVariables["ASPNETCORE_URLS"] = ReferenceExpression.Create($"http://+:{endpoint.Property(EndpointProperty.TargetPort)}"); 408context.Args.Add(targetEndpoint.Property(EndpointProperty.TargetPort)); 438context.Args.Add(targetEndpoint.Property(EndpointProperty.TargetPort));
DurableTask\DurableTaskSchedulerResource.cs (4)
36return ReferenceExpression.Create($"Endpoint={grpcEndpoint.Property(EndpointProperty.Scheme)}://{grpcEndpoint.Property(EndpointProperty.Host)}:{grpcEndpoint.Property(EndpointProperty.Port)};Authentication=None"); 58return ReferenceExpression.Create($"{dashboardEndpoint.Property(EndpointProperty.Url)}");
Aspire.Hosting.Azure.KeyVault (2)
AzureKeyVaultResource.cs (2)
59ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Url)}") : 75ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Url)}") :
Aspire.Hosting.Azure.Kubernetes.Tests (1)
AzureKubernetesFoundryReferenceTests.cs (1)
68.WithEnvironment("AGENT_URL", agent.GetEndpoint("http").Property(EndpointProperty.Url));
Aspire.Hosting.Azure.PostgreSQL (1)
AzurePostgresFlexibleServerResource.cs (1)
93ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}") :
Aspire.Hosting.Azure.Redis (2)
AzureManagedRedisResource.cs (1)
101ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(EndpointProperty.Host)}") :
AzureRedisCacheResource.cs (1)
82ReferenceExpression.Create($"{InnerResource.PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}") :
Aspire.Hosting.Azure.Sandboxes (24)
AzureSandboxContainerDeployment.cs (7)
1196EndpointProperty.Url).ConfigureAwait(false); 1220EndpointProperty property) 1226case EndpointProperty.Url: 1229case EndpointProperty.Host or EndpointProperty.IPV4Host: 1236case EndpointProperty.HostAndPort: 1292return TryResolveEndpointReferenceValue(endpointReference.Property(EndpointProperty.Url), currentComputeEnvironment, out expression);
AzureSandboxEndpointPropertyValueProvider.cs (15)
30if (endpointReferenceExpression.Property == EndpointProperty.TargetPort) 86EndpointProperty.TargetPort => _targetPort.ToString(CultureInfo.InvariantCulture), 87EndpointProperty.Scheme => Uri.UriSchemeHttps, 88EndpointProperty.Port => "443", 89EndpointProperty.TlsEnabled => bool.TrueString, 104EndpointProperty.Url => url, 105EndpointProperty.Host or EndpointProperty.IPV4Host => uri.Host, 106EndpointProperty.Port => uri.Port.ToString(CultureInfo.InvariantCulture), 107EndpointProperty.TargetPort => _targetPort.ToString(CultureInfo.InvariantCulture), 108EndpointProperty.Scheme => uri.Scheme, 109EndpointProperty.HostAndPort => uri.IsDefaultPort ? uri.Host : uri.Authority, 110EndpointProperty.TlsEnabled => string.Equals(uri.Scheme, Uri.UriSchemeHttps, StringComparison.OrdinalIgnoreCase) ? bool.TrueString : bool.FalseString, 111EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin =>
AzureSandboxGroupResource.cs (1)
294return GetEndpointPropertyExpression(endpointReference.Property(EndpointProperty.Host));
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Azure.ServiceBus (5)
AzureServiceBusExtensions.cs (1)
493context.EnvironmentVariables.TryAdd("SQL_SERVER", sqlConnection.Endpoint.Property(EndpointProperty.HostAndPort));
AzureServiceBusResource.cs (4)
59ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Host)}") : 71ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Port)}") : 82ReferenceExpression.Create($"sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)}") : 90? ReferenceExpression.Create($"Endpoint=sb://{EmulatorEndpoint.Property(EndpointProperty.HostAndPort)};SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;")
Aspire.Hosting.Azure.SignalR (2)
AzureSignalRResource.cs (2)
55ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Url)}") : 63ReferenceExpression.Create($"Endpoint={EmulatorEndpoint.Property(EndpointProperty.Url)};AccessKey=ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCDEFGH;Version=1.0;"):
Aspire.Hosting.Azure.Sql (1)
AzureSqlServerResource.cs (1)
98ReferenceExpression.Create($"{InnerResource!.PrimaryEndpoint.Property(EndpointProperty.Host)}") :
Aspire.Hosting.Azure.Storage (6)
AzureStorageEmulatorConnectionString.cs (3)
35builder.Append($"{key}={endpoint.Property(EndpointProperty.Scheme)}://{endpoint.Property(EndpointProperty.IPV4Host)}:{endpoint.Property(EndpointProperty.Port)}/devstoreaccount1;");
AzureStorageResource.cs (3)
97? ReferenceExpression.Create($"{EmulatorBlobEndpoint.Property(EndpointProperty.Url)}") 117? ReferenceExpression.Create($"{EmulatorQueueEndpoint.Property(EndpointProperty.Url)}") 127? ReferenceExpression.Create($"{EmulatorTableEndpoint.Property(EndpointProperty.Url)}")
Aspire.Hosting.Azure.Tests (97)
AzureAppServiceTests.cs (10)
439.WithEnvironment("AGENT_URL", agent.GetEndpoint("http").Property(EndpointProperty.Url)); 1198[InlineData(EndpointProperty.Url, "https://project1-website123.azurewebsites.net")] 1199[InlineData(EndpointProperty.Host, "project1-website123.azurewebsites.net")] 1200[InlineData(EndpointProperty.IPV4Host, "project1-website123.azurewebsites.net")] 1201[InlineData(EndpointProperty.Port, "443")] 1202[InlineData(EndpointProperty.TargetPort, "5000")] 1203[InlineData(EndpointProperty.Scheme, "https")] 1204[InlineData(EndpointProperty.HostAndPort, "project1-website123.azurewebsites.net")] 1205[InlineData(EndpointProperty.TlsEnabled, "True")] 1206public async Task GetEndpointPropertyExpression_ReturnsAppServiceEndpointPropertyExpression(EndpointProperty property, string expected)
AzureContainerAppExpressEndpointTests.cs (45)
41foreach (var property in new[] 43EndpointProperty.Url, EndpointProperty.Host, EndpointProperty.IPV4Host, 44EndpointProperty.HostAndPort, EndpointProperty.Port, EndpointProperty.TargetPort, 45EndpointProperty.Scheme, EndpointProperty.TlsEnabled 54context.EnvironmentVariables["SELF_TARGET_PORT"] = web.GetEndpoint("http").Property(EndpointProperty.TargetPort); 100var expectedValues = new Dictionary<EndpointProperty, string> 102[EndpointProperty.Url] = "https://api.salmonisland-e9e6a567.westus3.azurecontainerapps.io", 103[EndpointProperty.BrowserOrigins] = "https://api.salmonisland-e9e6a567.westus3.azurecontainerapps.io", 104[EndpointProperty.PrimaryBrowserOrigin] = "https://api.salmonisland-e9e6a567.westus3.azurecontainerapps.io", 105[EndpointProperty.Host] = "api.salmonisland-e9e6a567.westus3.azurecontainerapps.io", 106[EndpointProperty.IPV4Host] = "api.salmonisland-e9e6a567.westus3.azurecontainerapps.io", 107[EndpointProperty.HostAndPort] = "api.salmonisland-e9e6a567.westus3.azurecontainerapps.io:443", 108[EndpointProperty.Port] = "443", 109[EndpointProperty.TargetPort] = "8080", 110[EndpointProperty.Scheme] = "https", 111[EndpointProperty.TlsEnabled] = "True" 126[InlineData(EndpointProperty.Port, "443")] 127[InlineData(EndpointProperty.TargetPort, "8080")] 128[InlineData(EndpointProperty.Scheme, "https")] 129[InlineData(EndpointProperty.TlsEnabled, "True")] 130public async Task NonHostPropertiesResolveWithoutMaterializingDeploymentTargets(EndpointProperty property, string expected) 143[InlineData(EndpointProperty.Url)] 144[InlineData(EndpointProperty.Host)] 145[InlineData(EndpointProperty.IPV4Host)] 146[InlineData(EndpointProperty.HostAndPort)] 147[InlineData(EndpointProperty.Port)] 148[InlineData(EndpointProperty.TargetPort)] 149[InlineData(EndpointProperty.Scheme)] 150[InlineData(EndpointProperty.TlsEnabled)] 151[InlineData(EndpointProperty.BrowserOrigins)] 152[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 153public void InternalEndpointReferencesRequireExplicitPublicIngress(EndpointProperty property) 203[InlineData(EndpointProperty.BrowserOrigins)] 204[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 205public async Task BrowserOriginPropertiesUseTheNormalLocalVisibilityValidation(EndpointProperty property) 249web.WithEnvironment("HOST", api.GetEndpoint("http").Property(EndpointProperty.Host)); 286.WithEnvironment("API_HOST", endpoint.Property(EndpointProperty.Host)) 287.WithEnvironment("API_AUTHORITY", ReferenceExpression.Create($"api={endpoint.Property(EndpointProperty.HostAndPort)}")); 319.WithEnvironment("API_URL", api.GetEndpoint("http").Property(EndpointProperty.Url)); 345? environment.Resource.GetEndpointPropertyExpression(endpoint.Property(EndpointProperty.Url))
AzureContainerAppsTests.cs (22)
202.WithEnvironment("AGENT_URL", agent.GetEndpoint("http").Property(EndpointProperty.Url)); 423context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort); 424context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port); 425context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host); 426context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort); 427context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme); 428context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort); 529context.EnvironmentVariables["TARGET_PORT"] = httpEp.Property(EndpointProperty.TargetPort); 530context.EnvironmentVariables["PORT"] = httpEp.Property(EndpointProperty.Port); 531context.EnvironmentVariables["HOST"] = httpEp.Property(EndpointProperty.Host); 532context.EnvironmentVariables["HOSTANDPORT"] = httpEp.Property(EndpointProperty.HostAndPort); 533context.EnvironmentVariables["SCHEME"] = httpEp.Property(EndpointProperty.Scheme); 534context.EnvironmentVariables["INTERNAL_HOSTANDPORT"] = internalEp.Property(EndpointProperty.HostAndPort); 2885[InlineData(EndpointProperty.Url, "https://project1.example.azurecontainerapps.io")] 2886[InlineData(EndpointProperty.Host, "project1.example.azurecontainerapps.io")] 2887[InlineData(EndpointProperty.IPV4Host, "project1.example.azurecontainerapps.io")] 2888[InlineData(EndpointProperty.Port, "443")] 2889[InlineData(EndpointProperty.TargetPort, "5000")] 2890[InlineData(EndpointProperty.Scheme, "https")] 2891[InlineData(EndpointProperty.HostAndPort, "project1.example.azurecontainerapps.io:443")] 2892[InlineData(EndpointProperty.TlsEnabled, "True")] 2893public async Task GetEndpointPropertyExpression_ReturnsContainerAppEndpointPropertyExpression(EndpointProperty property, string expected)
AzureEnvironmentResourceTests.cs (9)
22[InlineData(false, false, EndpointProperty.BrowserOrigins)] 23[InlineData(true, false, EndpointProperty.BrowserOrigins)] 24[InlineData(false, true, EndpointProperty.BrowserOrigins)] 25[InlineData(true, true, EndpointProperty.BrowserOrigins)] 26[InlineData(false, false, EndpointProperty.PrimaryBrowserOrigin)] 27[InlineData(true, false, EndpointProperty.PrimaryBrowserOrigin)] 28[InlineData(false, true, EndpointProperty.PrimaryBrowserOrigin)] 29[InlineData(true, true, EndpointProperty.PrimaryBrowserOrigin)] 30public void ComputeEnvironmentExplainsUnsupportedBrowserOrigins(bool appService, bool nonHttp, EndpointProperty property)
AzureFrontDoorPrivateLinkTests.cs (1)
149.WithEnvironment("API_HOST", api.GetEndpoint("https").Property(EndpointProperty.Host));
AzureProvisioningResourceExtensionsTests.cs (1)
23var referenceExpression = ReferenceExpression.Create($"prefix:{endpointReference.Property(EndpointProperty.HostAndPort)}");
AzureSandboxesTests.cs (5)
33[InlineData(EndpointProperty.BrowserOrigins, "https://api.example.test")] 34[InlineData(EndpointProperty.PrimaryBrowserOrigin, "https://api.example.test")] 35public async Task BrowserOriginsUseDeployedSandboxProxyAuthority(EndpointProperty property, string expected) 2265Assert.True(AzureSandboxContainerDeployment.TryResolveEndpointReferenceValue(api.GetEndpoint("http").Property(EndpointProperty.TargetPort), sandboxGroup.Resource, out var targetPortExpression)); 3260$"https://{api.GetEndpoint("http").Property(EndpointProperty.HostAndPort)}/v1"))
FoundryExtensionsTests.cs (1)
898context.EnvironmentVariables["WEATHER_HOST_AND_PORT"] = weatherAgent.GetEndpoint("http").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.Azure.WebPubSub (1)
AzureWebPubSubResource.cs (1)
68IsEmulator ? ReferenceExpression.Create($"{EmulatorEndpoint.Property(EndpointProperty.Url)}") : ReferenceExpression.Create($"{Endpoint}");
Aspire.Hosting.DevTunnels (4)
DevTunnelResource.cs (4)
106return await GetResolvedEndpointPortAsync(EndpointProperty.Port, cancellationToken).ConfigureAwait(false) 115return await GetResolvedEndpointPortAsync(EndpointProperty.TargetPort, cancellationToken).ConfigureAwait(false) 119private async ValueTask<int?> GetResolvedEndpointPortAsync(EndpointProperty property, CancellationToken cancellationToken) 126catch (InvalidOperationException) when (property == EndpointProperty.TargetPort && TargetEndpoint.IsAllocated)
Aspire.Hosting.Docker (12)
DockerComposeServiceResourceExtensions.cs (12)
28var url = GetValue(mapping, EndpointProperty.Url); 53if (epExpr.Property == EndpointProperty.TlsEnabled) 64EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 135private static string GetValue(DockerComposeServiceResource.EndpointMapping mapping, EndpointProperty property) 139EndpointProperty.Url => GetHostValue($"{mapping.Scheme}://", $":{mapping.InternalPort}"), 140EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 141EndpointProperty.Port => mapping.InternalPort, 142EndpointProperty.HostAndPort => GetHostValue(suffix: $":{mapping.InternalPort}"), 143EndpointProperty.TargetPort => $"{mapping.InternalPort}", 144EndpointProperty.Scheme => mapping.Scheme,
Aspire.Hosting.Docker.Tests (11)
DockerComposePublisherTests.cs (11)
96[InlineData("http", false, EndpointProperty.BrowserOrigins)] 97[InlineData("tcp", true, EndpointProperty.BrowserOrigins)] 98[InlineData("tcp", false, EndpointProperty.BrowserOrigins)] 99[InlineData("http", false, EndpointProperty.PrimaryBrowserOrigin)] 100[InlineData("tcp", true, EndpointProperty.PrimaryBrowserOrigin)] 101[InlineData("tcp", false, EndpointProperty.PrimaryBrowserOrigin)] 102public async Task BrowserOriginsRejectInternalOrNonHttpEndpoints(string scheme, bool external, EndpointProperty property) 253context.EnvironmentVariables["TP"] = resource.GetEndpoint("http").Property(EndpointProperty.TargetPort); 254context.EnvironmentVariables["TPH2"] = resource.GetEndpoint("h2").Property(EndpointProperty.TargetPort); 1502.WithEnvironment("CACHE_TLS", cache.GetEndpoint("tls").Property(EndpointProperty.TlsEnabled)) 1503.WithEnvironment("CACHE_PLAIN_TLS", cache.GetEndpoint("tcp").Property(EndpointProperty.TlsEnabled));
Aspire.Hosting.Foundry (8)
HostedAgent\AzureHostedAgentResource.cs (2)
407return endpointReferenceExpression.Property == EndpointProperty.TargetPort && 424return await ResolvePublishedEndpointAsync(endpointReference.Property(EndpointProperty.Url), context, hostedAgent, resource, environmentVariableName, cancellationToken).ConfigureAwait(false);
Project\ProjectResource.cs (5)
233var property = endpointReferenceExpression.Property; 236EndpointProperty.Url => GetAgentAddressExpression(endpointReferenceExpression.Endpoint), 237EndpointProperty.Scheme => ReferenceExpression.Create($"https"), 238EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin =>
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Foundry.Tests (3)
ProjectResourceTests.cs (3)
15[InlineData(EndpointProperty.BrowserOrigins, "{my-project.outputs.endpointOrigin}", "https://account.services.ai.azure.com")] 16[InlineData(EndpointProperty.PrimaryBrowserOrigin, "{my-project.outputs.endpointOrigin}", "https://account.services.ai.azure.com")] 17public async Task BrowserOriginPropertiesUseDeployedProjectAuthority(EndpointProperty property, string expression, string expected)
Aspire.Hosting.Garnet (3)
GarnetResource.cs (3)
38public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 43public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 69builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.JavaScript (4)
DenoHostingExtensions.cs (2)
440context.EnvironmentVariables["PORT"] = endpointReference.Property(EndpointProperty.TargetPort); 1424: endpoint.Property(EndpointProperty.TargetPort);
JavaScriptHostingExtensions.cs (2)
2031c.Args.Add(targetEndpoint.Property(EndpointProperty.TargetPort)); 2232c.Args.Add(targetEndpoint.Property(EndpointProperty.TargetPort));
Aspire.Hosting.Kafka (10)
KafkaBuilderExtensions.cs (7)
164? ReferenceExpression.Create($"{endpoint.Resource.Name}:{endpoint.Property(EndpointProperty.TargetPort)}") 165: ReferenceExpression.Create($"{endpoint.Property(EndpointProperty.HostAndPort)}"); 247? ReferenceExpression.Create($"PLAINTEXT://localhost:29092,PLAINTEXT_HOST://localhost:{primaryEndpoint.Property(EndpointProperty.Port)},PLAINTEXT_INTERNAL://{resource.Name}:{internalEndpoint.Property(EndpointProperty.TargetPort)}") 248: ReferenceExpression.Create($"PLAINTEXT://{primaryEndpoint.Property(EndpointProperty.Host)}:29092,PLAINTEXT_HOST://{primaryEndpoint.Property(EndpointProperty.HostAndPort)},PLAINTEXT_INTERNAL://{internalEndpoint.Property(EndpointProperty.HostAndPort)}");
KafkaServerResource.cs (3)
35public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 40public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 52ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Keycloak (1)
KeycloakResourceBuilderExtensions.cs (1)
120context.EnvironmentVariables["KC_HTTPS_PORT"] = keycloak.GetEndpoint(KeycloakResource.PrimaryEndpointName).Property(EndpointProperty.TargetPort);
Aspire.Hosting.Kubernetes (17)
KubernetesEnvironmentContext.cs (1)
60return reference.Property == EndpointProperty.PrimaryBrowserOrigin
KubernetesResource.cs (15)
340Port = GetEndpointValue(endpointMapping, EndpointProperty.TargetPort), 561var url = GetEndpointValue(mapping, EndpointProperty.Url); 599if (epExpr.Property == EndpointProperty.TlsEnabled) 612EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 614_ => GetEndpointValue(mapping, epExpr.Property, embedded && epExpr.Property is EndpointProperty.Port or EndpointProperty.TargetPort) 776private static string GetEndpointValue(EndpointMapping mapping, EndpointProperty property, bool embedded = false) 791EndpointProperty.Url => GetHostValue($"{scheme}://", suffix: GetPortSuffix(servicePort)), 792EndpointProperty.Host or EndpointProperty.IPV4Host => GetHostValue(), 793EndpointProperty.Port => GetPort(servicePort), 794EndpointProperty.HostAndPort => GetHostValue(suffix: GetPortSuffix(servicePort)), 795EndpointProperty.TargetPort => GetPort(targetPort), 796EndpointProperty.Scheme => scheme,
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
Aspire.Hosting.Kubernetes.Tests (10)
KubernetesPublisherTests.cs (10)
24[InlineData("tcp", false, EndpointProperty.BrowserOrigins)] 25[InlineData("tcp", true, EndpointProperty.BrowserOrigins)] 26[InlineData("http", false, EndpointProperty.BrowserOrigins)] 27[InlineData("tcp", false, EndpointProperty.PrimaryBrowserOrigin)] 28[InlineData("tcp", true, EndpointProperty.PrimaryBrowserOrigin)] 29[InlineData("http", false, EndpointProperty.PrimaryBrowserOrigin)] 30public void BrowserOriginsRejectInternalOrNonHttpEndpoints(string scheme, bool external, EndpointProperty property) 71.WithEnvironment("PORT", web.GetEndpoint("HTTP").Property(EndpointProperty.Port)); 2109.WithEnvironment("CACHE_TLS", cache.GetEndpoint("tls").Property(EndpointProperty.TlsEnabled)) 2110.WithEnvironment("CACHE_PLAIN_TLS", cache.GetEndpoint("tcp").Property(EndpointProperty.TlsEnabled));
Aspire.Hosting.Maui (5)
MauiOtlpExtensions.cs (5)
328var allocatedPort = await TryGetEndpointPortAsync(endpointReference, EndpointProperty.Port, cancellationToken).ConfigureAwait(false); 338var targetPort = await TryGetEndpointPortAsync(endpointReference, EndpointProperty.TargetPort, cancellationToken).ConfigureAwait(false); 365var targetPort = await TryGetEndpointPortAsync(endpointReference, EndpointProperty.TargetPort, cancellationToken).ConfigureAwait(false); 371EndpointProperty property, 379catch (InvalidOperationException) when (property == EndpointProperty.TargetPort && endpointReference.IsAllocated)
Aspire.Hosting.Milvus (3)
MilvusServerResource.cs (3)
45public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 50public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 73public ReferenceExpression UriExpression => ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}");
Aspire.Hosting.MongoDB (5)
MongoDBServerResource.cs (3)
47public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 52public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 147builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
ReplicaSet\MongoDBReplicaSetBuilderExtensions.cs (1)
162.Property(EndpointProperty.HostAndPort)
ReplicaSet\MongoDBReplicaSetResource.cs (1)
107builder.Append($"{member.PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.MySql (4)
MySqlServerResource.cs (4)
42public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 47public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 59$"Server={PrimaryEndpoint.Property(EndpointProperty.Host)};Port={PrimaryEndpoint.Property(EndpointProperty.Port)};User ID={DefaultUserName};Password={PasswordParameter}");
Aspire.Hosting.Nats (3)
NatsServerResource.cs (3)
42public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 47public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 100builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Oracle (3)
OracleDatabaseServerResource.cs (3)
39public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 44public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 56$"user id={DefaultUserName};password={PasswordParameter};data source={PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.PostgreSQL (4)
PostgresServerResource.cs (4)
61$"Host={PrimaryEndpoint.Property(EndpointProperty.Host)};Port={PrimaryEndpoint.Property(EndpointProperty.Port)};Username={UserNameReference};Password={PasswordParameter}"); 112public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 117public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port);
Aspire.Hosting.Python (1)
PythonAppResourceBuilderExtensions.cs (1)
299c.Args.Add(endpoint.Property(EndpointProperty.TargetPort));
Aspire.Hosting.Qdrant (8)
QdrantServerResource.cs (8)
45public EndpointReferenceExpression GrpcHost => PrimaryEndpoint.Property(EndpointProperty.Host); 50public EndpointReferenceExpression GrpcPort => PrimaryEndpoint.Property(EndpointProperty.Port); 60public EndpointReferenceExpression HttpHost => HttpEndpoint.Property(EndpointProperty.Host); 65public EndpointReferenceExpression HttpPort => HttpEndpoint.Property(EndpointProperty.Port); 72$"Endpoint={PrimaryEndpoint.Property(EndpointProperty.Url)};Key={ApiKeyParameter}"); 80public ReferenceExpression UriExpression => ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}"); 87$"Endpoint={HttpEndpoint.Property(EndpointProperty.Url)};Key={ApiKeyParameter}"); 95public ReferenceExpression HttpUriExpression => ReferenceExpression.Create($"{HttpEndpoint.Property(EndpointProperty.Url)}");
Aspire.Hosting.RabbitMQ (3)
RabbitMQServerResource.cs (3)
48public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 53public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 104builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Radius (32)
Publishing\RadiusInfrastructureBuilder.cs (17)
3340EndpointProperty property, 3380case EndpointProperty.Host or EndpointProperty.IPV4Host: 3383case EndpointProperty.Port or EndpointProperty.TargetPort: 3386case EndpointProperty.HostAndPort: 3391case EndpointProperty.Url: 3397case EndpointProperty.Scheme: 3400case EndpointProperty.TlsEnabled: 3464EndpointProperty property, 3469property is not (EndpointProperty.Scheme or EndpointProperty.TlsEnabled or EndpointProperty.Url)) 4149if (!TryProjectBackingEndpoint(endpointReference, EndpointProperty.Url, parts)) 4155EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin: 4890ResolveHostExpression(((IComputeEnvironmentResource)_environment).GetEndpointPropertyExpression(endpointReference.Property(EndpointProperty.Url)));
RadiusEnvironmentResource.cs (15)
174var property = endpointReferenceExpression.Property; 201EndpointProperty.BrowserOrigins or EndpointProperty.PrimaryBrowserOrigin => 205EndpointProperty.Url => IsDefaultPort(scheme, port.Value) 208EndpointProperty.Host or EndpointProperty.IPV4Host => host.Value, 209EndpointProperty.Port => GuardedAddress(endpointReference, () => ReferenceExpression.Create($"{RadiusServiceDiscovery.ToInvariantString(port.Value)}")), 215EndpointProperty.TargetPort => GuardedAddress(endpointReference, () => resolvedServicePort.Value is int targetPort 218EndpointProperty.Scheme => ReferenceExpression.Create($"{scheme}"), 219EndpointProperty.HostAndPort => ReferenceExpression.Create($"{host.Value}:{RadiusServiceDiscovery.ToInvariantString(port.Value)}"), 220EndpointProperty.TlsEnabled => ReferenceExpression.Create($"{(endpoint.TlsEnabled ? bool.TrueString : bool.FalseString)}"), 241private static void ThrowIfTransportSecurityIsNotRecipeBacked(EndpointReference endpointReference, EndpointProperty property) 244property is not (EndpointProperty.Scheme or EndpointProperty.TlsEnabled or EndpointProperty.Url))
Aspire.Hosting.Radius.Tests (50)
Publishing\BackingResourceContractTests.cs (12)
126[InlineData(EndpointProperty.Host)] 127[InlineData(EndpointProperty.Port)] 128[InlineData(EndpointProperty.Url)] 129[InlineData(EndpointProperty.HostAndPort)] 130[InlineData(EndpointProperty.TargetPort)] 131public void CrossEnvironmentEndpointResolution_FailsWithThePublicException(EndpointProperty property) 158.GetEndpointPropertyExpression(cache.GetEndpoint("tcp").Property(EndpointProperty.Host))); 198/// <see cref="EndpointProperty.Scheme"/> and <see cref="EndpointProperty.TlsEnabled"/> are read 209[InlineData(EndpointProperty.Scheme, "redis")] 210[InlineData(EndpointProperty.TlsEnabled, "False")] 211public void NonAddressEndpointProperties_AreResolvedForBackingResources(EndpointProperty property, string expected)
Publishing\BackingResourceProjectionTests.cs (4)
90.WithEnvironment("CUSTOM_HOST", cache.GetEndpoint("tcp").Property(EndpointProperty.Host)) 91.WithEnvironment("CUSTOM_PORT", cache.GetEndpoint("tcp").Property(EndpointProperty.Port)) 92.WithEnvironment("CUSTOM_URL", cache.GetEndpoint("tcp").Property(EndpointProperty.Url)); 112.WithEnvironment("BACKEND_HOST", backend.GetEndpoint("http").Property(EndpointProperty.Host));
Publishing\BackingResourceValueResolutionTests.cs (10)
125.WithEnvironment("MISSING", backend.GetEndpoint("does-not-exist").Property(EndpointProperty.Host)) 126.WithEnvironment("PRESENT", backend.GetEndpoint("http").Property(EndpointProperty.Host)); 415.WithEnvironment("MGMT_URL", rabbit.GetEndpoint("management").Property(EndpointProperty.Url)); 434.WithEnvironment("AMQP_HOST", rabbit.GetEndpoint("tcp").Property(EndpointProperty.Host)); 967.WithEnvironment("CACHE_URL", cache.GetEndpoint("tcp").Property(EndpointProperty.Url)); 986.WithEnvironment("CACHE_HOST", cache.GetEndpoint("tcp").Property(EndpointProperty.Host)) 987.WithEnvironment("CACHE_PORT", cache.GetEndpoint("tcp").Property(EndpointProperty.Port)); 1190var port = cache.GetEndpoint("tcp").Property(EndpointProperty.Port); 1217ReferenceExpression.Create($"primary-{cache.GetEndpoint("tcp").Property(EndpointProperty.Host)}"), 1476.WithEnvironment("STORE_HOST", store.GetEndpoint("tcp").Property(EndpointProperty.Host));
Publishing\RadiusDeployParametersTests.cs (7)
23[InlineData("http", false, false, EndpointProperty.BrowserOrigins)] 24[InlineData("tcp", true, false, EndpointProperty.BrowserOrigins)] 25[InlineData("http", true, true, EndpointProperty.BrowserOrigins)] 26[InlineData("http", false, false, EndpointProperty.PrimaryBrowserOrigin)] 27[InlineData("tcp", true, false, EndpointProperty.PrimaryBrowserOrigin)] 28[InlineData("http", true, true, EndpointProperty.PrimaryBrowserOrigin)] 29public async Task BrowserOriginsRejectUnsupportedEndpoints(string scheme, bool external, bool backingResource, EndpointProperty property)
RadiusEnvironmentResourceTests.cs (17)
15[InlineData(EndpointProperty.BrowserOrigins)] 16[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 17public void BrowserOriginsExplainWhyServiceDnsIsInsufficient(EndpointProperty property) 91[InlineData(EndpointProperty.Url, "http://api-api.default.svc.cluster.local:8080")] 92[InlineData(EndpointProperty.Host, "api-api.default.svc.cluster.local")] 93[InlineData(EndpointProperty.IPV4Host, "api-api.default.svc.cluster.local")] 94[InlineData(EndpointProperty.HostAndPort, "api-api.default.svc.cluster.local:8080")] 95[InlineData(EndpointProperty.Port, "8080")] 96[InlineData(EndpointProperty.TargetPort, "8080")] 97[InlineData(EndpointProperty.Scheme, "http")] 98public void GetEndpointPropertyExpression_UsesServiceNameAndContainerPort(EndpointProperty property, string expected) 126[InlineData(EndpointProperty.Scheme)] 127[InlineData(EndpointProperty.TlsEnabled)] 128[InlineData(EndpointProperty.Url)] 129public void GetEndpointPropertyExpression_TlsEnabledBackingResource_Throws(EndpointProperty property) 166.GetEndpointPropertyExpression(endpoint.Property(EndpointProperty.Scheme)); 188.GetEndpointPropertyExpression(endpoint.Property(EndpointProperty.Scheme));
Aspire.Hosting.Redis (7)
RedisBuilderExtensions.cs (3)
209argsCtx.Args.Add(redis.GetEndpoint(RedisResource.PrimaryEndpointName).Property(EndpointProperty.TargetPort)); 211argsCtx.Args.Add(redis.GetEndpoint(RedisResource.SecondaryEndpointName).Property(EndpointProperty.TargetPort)); 399context.EnvironmentVariables[$"RI_REDIS_HOST{counter}"] = redisInstance.PrimaryEndpoint.Property(EndpointProperty.Host);
RedisResource.cs (4)
57public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 62public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 90builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}"); 151builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.Scheme)}");
Aspire.Hosting.Seq (4)
SeqResource.cs (4)
28public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 33public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 39ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}"); 47public ReferenceExpression UriExpression => ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}");
Aspire.Hosting.SqlServer (4)
SqlServerServerResource.cs (4)
39public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 44public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 53$"Server={PrimaryEndpoint.Property(EndpointProperty.IPV4Host)},{PrimaryEndpoint.Property(EndpointProperty.Port)};User ID={DefaultUserName};Password={PasswordParameter};TrustServerCertificate=true");
Aspire.Hosting.Tests (147)
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 _));
ComputeEnvironmentValidationTests.cs (15)
14[InlineData("http", EndpointProperty.BrowserOrigins)] 15[InlineData("tcp", EndpointProperty.BrowserOrigins)] 16[InlineData("http", EndpointProperty.PrimaryBrowserOrigin)] 17[InlineData("tcp", EndpointProperty.PrimaryBrowserOrigin)] 18public void DefaultComputeEnvironmentExplainsMissingBrowserOriginSupport(string scheme, EndpointProperty property) 85[InlineData(EndpointProperty.Url, "http://api.example.com:8080")] 86[InlineData(EndpointProperty.Host, "api.example.com")] 87[InlineData(EndpointProperty.IPV4Host, "api.example.com")] 88[InlineData(EndpointProperty.Port, "8080")] 89[InlineData(EndpointProperty.TargetPort, "5000")] 90[InlineData(EndpointProperty.Scheme, "http")] 91[InlineData(EndpointProperty.HostAndPort, "api.example.com:8080")] 92[InlineData(EndpointProperty.TlsEnabled, "False")] 93public async Task GetEndpointPropertyExpression_ReturnsDefaultEndpointPropertyExpression(EndpointProperty property, string expected) 112var ex = Assert.Throws<InvalidOperationException>(() => environment.GetEndpointPropertyExpression(endpointReference.Property(EndpointProperty.Url)));
ConditionalReferenceExpressionTests.cs (5)
86var condition = endpointRef.Property(EndpointProperty.TlsEnabled); 250var tlsExpr = endpointRef.Property(EndpointProperty.TlsEnabled); 267var tlsExpr = endpointRef.Property(EndpointProperty.TlsEnabled); 281var tlsExpr = endpointRef.Property(EndpointProperty.TlsEnabled); 294var tlsExpr = endpointRef.Property(EndpointProperty.TlsEnabled);
Dcp\DcpExecutorTests.cs (33)
771.WithArgs(c => c.Args.Add(endpoint.Property(EndpointProperty.Port))); 811c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port)); 5016Assert.Equal(allocatedPort.ToString(CultureInfo.InvariantCulture), await database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port).GetValueAsync()); 5032database.WithEnvironment("PUBLIC_PORT", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port)); 5033database.WithEnvironment("PUBLIC_PORT_AGAIN", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.Port)); 5080database.WithEnvironment("PUBLIC_HOST_AND_PORT", database.GetEndpoint("NoPortTargetPortSet").Property(EndpointProperty.HostAndPort)); 10293.WithEnvironment("EXE_PROXIED_PORT", executable.GetEndpoint("proxied").Property(EndpointProperty.Port)) 10294.WithEnvironment("EXE_NOTPROXIED_PORT", executable.GetEndpoint("notProxied").Property(EndpointProperty.Port)); 10300.WithEnvironment("EXE_PROXIED_PORT", executable.GetEndpoint("proxied").Property(EndpointProperty.Port)) 10301.WithEnvironment("EXE_NOTPROXIED_PORT", executable.GetEndpoint("notProxied").Property(EndpointProperty.Port)); 10484c.EnvironmentVariables["EXEC_PORT"] = executable.GetEndpoint("http").Property(EndpointProperty.Port); 10519c.EnvironmentVariables["EXEC_PORT"] = executable.GetEndpoint("http").Property(EndpointProperty.Port); 10560c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port)); 10796c.Args.Add(executable.GetEndpoint("http").Property(EndpointProperty.Port)); 10833.WithEnvironment("EXEC_PORT", executable.GetEndpoint("http").Property(EndpointProperty.Port)); 10864.WithEnvironment("EXECUTABLE_PORT", executable.GetEndpoint("http").Property(EndpointProperty.Port)); 10897$"{containerEndpoint.Property(EndpointProperty.Scheme)}://{containerEndpoint.Property(EndpointProperty.Host)}:{containerEndpoint.Property(EndpointProperty.Port)}")) 10898.WithEnvironment("HOST_PORT", executable.GetEndpoint("unused").Property(EndpointProperty.Port)); 10942.WithEnvironment("TARGET_PORT", targetEndpoint.Property(EndpointProperty.Port)); 10986project.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11025target.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11062executable.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11131executable.GetEndpoint("udp", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11186target.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11227context.EnvironmentVariables["CONTAINER_PORT"] = containerEndpoint.Property(EndpointProperty.Port); 11276executable.GetEndpoint("http", KnownNetworkIdentifiers.DefaultAspireContainerNetwork).Property(EndpointProperty.Port)); 11316.WithEnvironment("TARGET_PORT", containerEndpoint.Property(EndpointProperty.Port)); 11318.WithEnvironment("TARGET_PORT", target.GetEndpoint("http").Property(EndpointProperty.Port)); 11374.WithEnvironment("EXEC_A_PORT", executableA.GetEndpoint("http").Property(EndpointProperty.Port)); 11380.WithEnvironment("EXEC_B_PORT", executableB.GetEndpoint("http").Property(EndpointProperty.Port)) 11437.WithEnvironment("UPSTREAM_PORT", upstreamExecutable.GetEndpoint("http").Property(EndpointProperty.Port))
EndpointReferenceTests.cs (48)
74var endpointExpr = endpointRef.Property(EndpointProperty.Url); 94var endpointExpr = endpointRef.Property(EndpointProperty.Url); 108var hostExpr = endpointRef.Property(EndpointProperty.Host); 127var portExpr = endpointRef.Property(EndpointProperty.Port); 146var schemeExpr = endpointRef.Property(EndpointProperty.Scheme); 160var ipv4Expr = endpointRef.Property(EndpointProperty.IPV4Host); 174var targetPortExpr = endpointRef.Property(EndpointProperty.TargetPort); 188var targetPortExpr = endpointRef.Property(EndpointProperty.TargetPort); 207var endpointExpr = endpointRef.Property(EndpointProperty.Url); 225var expr1 = endpointRef.Property(EndpointProperty.Url); 226var expr2 = endpointRef.Property(EndpointProperty.Host); 227var expr3 = endpointRef.Property(EndpointProperty.Port); 342[InlineData(EndpointProperty.Url, ResourceKind.Host, ResourceKind.Host, "blah://localhost:1234")] 343[InlineData(EndpointProperty.Url, ResourceKind.Host, ResourceKind.Container, "blah://localhost:1234")] 344[InlineData(EndpointProperty.Url, ResourceKind.Container, ResourceKind.Host, "blah://host.docker.internal:1234")] 345[InlineData(EndpointProperty.Url, ResourceKind.Container, ResourceKind.Container, "blah://destination.dev.internal:4567")] 346[InlineData(EndpointProperty.Host, ResourceKind.Host, ResourceKind.Host, "localhost")] 347[InlineData(EndpointProperty.Host, ResourceKind.Host, ResourceKind.Container, "localhost")] 348[InlineData(EndpointProperty.Host, ResourceKind.Container, ResourceKind.Host, "host.docker.internal")] 349[InlineData(EndpointProperty.Host, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal")] 350[InlineData(EndpointProperty.IPV4Host, ResourceKind.Host, ResourceKind.Host, "127.0.0.1")] 351[InlineData(EndpointProperty.IPV4Host, ResourceKind.Host, ResourceKind.Container, "127.0.0.1")] 352[InlineData(EndpointProperty.IPV4Host, ResourceKind.Container, ResourceKind.Host, "host.docker.internal")] 353[InlineData(EndpointProperty.IPV4Host, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal")] 354[InlineData(EndpointProperty.Port, ResourceKind.Host, ResourceKind.Host, "1234")] 355[InlineData(EndpointProperty.Port, ResourceKind.Host, ResourceKind.Container, "1234")] 356[InlineData(EndpointProperty.Port, ResourceKind.Container, ResourceKind.Host, "1234")] 357[InlineData(EndpointProperty.Port, ResourceKind.Container, ResourceKind.Container, "4567")] 358[InlineData(EndpointProperty.Scheme, ResourceKind.Host, ResourceKind.Host, "blah")] 359[InlineData(EndpointProperty.Scheme, ResourceKind.Host, ResourceKind.Container, "blah")] 360[InlineData(EndpointProperty.Scheme, ResourceKind.Container, ResourceKind.Host, "blah")] 361[InlineData(EndpointProperty.Scheme, ResourceKind.Container, ResourceKind.Container, "blah")] 362[InlineData(EndpointProperty.HostAndPort, ResourceKind.Host, ResourceKind.Host, "localhost:1234")] 363[InlineData(EndpointProperty.HostAndPort, ResourceKind.Host, ResourceKind.Container, "localhost:1234")] 364[InlineData(EndpointProperty.HostAndPort, ResourceKind.Container, ResourceKind.Host, "host.docker.internal:1234")] 365[InlineData(EndpointProperty.HostAndPort, ResourceKind.Container, ResourceKind.Container, "destination.dev.internal:4567")] 366public async Task PropertyResolutionTest(EndpointProperty property, ResourceKind sourceKind, ResourceKind destinationKind, object expectedResult) 510Assert.Equal(EndpointProperty.BrowserOrigins, origins.Property); 511Assert.Equal(EndpointProperty.PrimaryBrowserOrigin, endpoint.PrimaryBrowserOrigin.Property); 599[InlineData(EndpointProperty.BrowserOrigins, "http://preferred.example:8080,https://frontend.example,https://127.0.0.1:8443,https://frontend.example:9443")] 600[InlineData(EndpointProperty.PrimaryBrowserOrigin, "http://preferred.example:8080")] 601public async Task BrowserOriginPropertiesResolveFinalizedUrls(EndpointProperty property, string expected) 635[InlineData(EndpointProperty.BrowserOrigins)] 636[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 637public async Task BrowserOriginPropertiesSupportCancellation(EndpointProperty property) 650[InlineData(EndpointProperty.BrowserOrigins)] 651[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 652public async Task BrowserOriginPropertiesAwaitFinalizedUrlsRegardlessOfExecutionMode(EndpointProperty property)
ExpressionResolverTests.cs (19)
356ReferenceExpression.Create($"{PrimaryEndpoint.Property(EndpointProperty.Url)}"); 380{ "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)}/;") }, 381{ "Url", ReferenceExpression.Create($"Url={Endpoint1.Property(EndpointProperty.Url)};") }, 383{ "OnlyHost", ReferenceExpression.Create($"Host={Endpoint1.Property(EndpointProperty.Host)};") }, 384{ "OnlyPort", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};") }, 385{ "HostAndPort", ReferenceExpression.Create($"HostPort={Endpoint1.Property(EndpointProperty.HostAndPort)}") }, 386{ "PortBeforeHost", ReferenceExpression.Create($"Port={Endpoint1.Property(EndpointProperty.Port)};Host={Endpoint1.Property(EndpointProperty.Host)};") }, 387{ "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)}/;") }, 392{ "UrlEncodedHost", ReferenceExpression.Create($"Host={Endpoint3.Property(EndpointProperty.Host):uri};") },
ManifestExpressionTests.cs (12)
75var secondName = ResourceNameHelpers.GetEndpointPropertyInputName("a", "b-c", nameof(EndpointProperty.BrowserOrigins), ModelName.DefaultMaxLength); 166var tls = endpoint.Property(EndpointProperty.TlsEnabled); 306backend.WithEnvironment("TLS", backend.GetEndpoint("http").Property(EndpointProperty.TlsEnabled)); 399[InlineData(EndpointProperty.BrowserOrigins)] 400[InlineData(EndpointProperty.PrimaryBrowserOrigin)] 401public async Task EndpointOriginPropertiesBecomeRequiredInputs(EndpointProperty property) 409var selected = ReferenceExpression.CreateConditional(endpoint.Property(EndpointProperty.TlsEnabled), bool.FalseString, 419.WithEnvironment("HOST", endpoint.Property(EndpointProperty.Host)); 472var origin = ReferenceExpression.Create($"{frontend.GetEndpoint("http").Property(EndpointProperty.BrowserOrigins)}"); 475frontend.GetEndpoint("http").Property(EndpointProperty.TlsEnabled), 500frontend.GetEndpoint("http").Property(EndpointProperty.TlsEnabled), bool.TrueString, 545var conditional = ReferenceExpression.CreateConditional(frontend.GetEndpoint("http").Property(EndpointProperty.TlsEnabled),
ResourceDependencyTests.cs (1)
55.WithEnvironment("API_PORT", api.GetEndpoint("http").Property(EndpointProperty.Port));
Schema\SchemaTests.cs (1)
55var tls = frontend.GetEndpoint("http").Property(EndpointProperty.TlsEnabled);
src\Shared\ComputeEnvironmentEndpointResolver.cs (1)
51endpointReference.Property(EndpointProperty.Url),
WithEnvironmentTests.cs (6)
68.WithEnvironment("PORT", $"{endpoint.Property(EndpointProperty.Port)}") 69.WithEnvironment("TARGET_PORT", $"{endpoint.Property(EndpointProperty.TargetPort)}") 116.WithEnvironment("URL", $"{endpoint.Property(EndpointProperty.Host)}:{endpoint.Property(EndpointProperty.Port)}"); 149.WithEnvironment("TARGET_PORT", $"{endpoint.Property(EndpointProperty.TargetPort)}"); 468var portProperty = endpoint.Property(EndpointProperty.Port);
Aspire.Hosting.Valkey (3)
ValkeyResource.cs (3)
43public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); 48public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); 69builder.Append($"{PrimaryEndpoint.Property(EndpointProperty.HostAndPort)}");
Aspire.Hosting.Yarp (5)
YarpResourceExtensions.cs (5)
72.WithEnvironment("ASPNETCORE_HTTPS_PORT", resource.GetEndpoint("https").Property(EndpointProperty.Port)) 73.WithEnvironment("ASPNETCORE_URLS", $"{resource.GetEndpoint("https").Property(EndpointProperty.Scheme)}://*:{resource.GetEndpoint("https").Property(EndpointProperty.TargetPort)};{resource.GetEndpoint("http").Property(EndpointProperty.Scheme)}://*:{resource.GetEndpoint("http").Property(EndpointProperty.TargetPort)}");
AspireWithNode.AppHost (1)
AppHost.cs (1)
44ctx.EnvironmentVariables["HTTPS_REDIRECT_PORT"] = httpsEndpoint.Property(EndpointProperty.Port);
Stress.AppHost (7)
AppHost.cs (7)
25.WithArgs(c => c.Args.Add(manualArgEndpoint.Property(EndpointProperty.Port))); 29.WithArgs(c => c.Args.Add(manualArgEndpoint.Property(EndpointProperty.Port))); 34.WithArgs(c => c.Args.Add(manualArgEndpoint.Property(EndpointProperty.Port))); 38.WithArgs(c => c.Args.Add(manualArgEndpoint.Property(EndpointProperty.Port))) 75.WithEnvironment("HOST", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Host)}") 76.WithEnvironment("PORT", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Port)}") 77.WithEnvironment("URL", $"{serviceBuilder.GetEndpoint("http").Property(EndpointProperty.Url)}");