Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma warning disable ASPIREPIPELINES001
#pragma warning disable ASPIREAZURE001

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Pipelines;
using Azure.Provisioning;
Expand Down Expand Up @@ -231,7 +232,9 @@ public AzureContainerRegistryResource? ContainerRegistry
ReferenceExpression IAzureContainerRegistry.ManagedIdentityId => ReferenceExpression.Create($"{ContainerRegistryManagedIdentityId}");
#pragma warning restore CS0618 // Type or member is obsolete

ReferenceExpression IComputeEnvironmentResource.GetHostAddressExpression(EndpointReference endpointReference)
/// <inheritdoc/>
[Experimental("ASPIRECOMPUTE002", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference)
{
var resource = endpointReference.Resource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma warning disable ASPIREPIPELINES001
#pragma warning disable ASPIREAZURE001

using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.AppService;
Expand Down Expand Up @@ -381,7 +382,9 @@ public AzureContainerRegistryResource? ContainerRegistry
ReferenceExpression IAzureContainerRegistry.ManagedIdentityId => ReferenceExpression.Create($"{ContainerRegistryManagedIdentityId}");
#pragma warning restore CS0618 // Type or member is obsolete

ReferenceExpression IComputeEnvironmentResource.GetHostAddressExpression(EndpointReference endpointReference)
/// <inheritdoc/>
[Experimental("ASPIRECOMPUTE002", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference)
{
var resource = endpointReference.Resource;
return ReferenceExpression.Create($"{resource.Name.ToLowerInvariant()}-{WebSiteSuffix}.azurewebsites.net");
Expand Down
10 changes: 4 additions & 6 deletions src/Aspire.Hosting.Docker/DockerComposeEnvironmentResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma warning disable ASPIREPIPELINES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
#pragma warning disable ASPIREPIPELINES003 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Dcp.Process;
using Aspire.Hosting.Docker.Resources;
Expand Down Expand Up @@ -185,12 +186,9 @@ public DockerComposeEnvironmentResource(string name) : base(name)
}));
}

/// <summary>
/// Computes the host URL <see cref="ReferenceExpression"/> for the given <see cref="EndpointReference"/>.
/// </summary>
/// <param name="endpointReference">The endpoint reference to compute the host address for.</param>
/// <returns>A <see cref="ReferenceExpression"/> representing the host address.</returns>
ReferenceExpression IComputeEnvironmentResource.GetHostAddressExpression(EndpointReference endpointReference)
/// <inheritdoc/>
[Experimental("ASPIRECOMPUTE002", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference)
{
var resource = endpointReference.Resource;

Expand Down
10 changes: 4 additions & 6 deletions src/Aspire.Hosting.Kubernetes/KubernetesEnvironmentResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma warning disable ASPIREPIPELINES001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Kubernetes.Extensions;
using Aspire.Hosting.Pipelines;
Expand Down Expand Up @@ -99,12 +100,9 @@ public KubernetesEnvironmentResource(string name) : base(name)
}));
}

/// <summary>
/// Computes the host URL <see cref="ReferenceExpression"/> for the given <see cref="EndpointReference"/>.
/// </summary>
/// <param name="endpointReference">The endpoint reference to compute the host address for.</param>
/// <returns>A <see cref="ReferenceExpression"/> representing the host address.</returns>
ReferenceExpression IComputeEnvironmentResource.GetHostAddressExpression(EndpointReference endpointReference)
/// <inheritdoc/>
[Experimental("ASPIRECOMPUTE002", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public ReferenceExpression GetHostAddressExpression(EndpointReference endpointReference)
{
var resource = endpointReference.Resource;

Expand Down
2 changes: 1 addition & 1 deletion tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ public async Task GetHostAddressExpression()
.AddProject<Project>("project1", launchProfileName: null)
.WithHttpEndpoint();

var endpointReferenceEx = ((IComputeEnvironmentResource)env.Resource).GetHostAddressExpression(project.GetEndpoint("http"));
var endpointReferenceEx = env.Resource.GetHostAddressExpression(project.GetEndpoint("http"));
Assert.NotNull(endpointReferenceEx);

Assert.Equal("project1-{0}.azurewebsites.net", endpointReferenceEx.Format);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2099,7 +2099,7 @@ public async Task GetHostAddressExpression()
.AddProject<Project>("project1", launchProfileName: null)
.WithHttpEndpoint();

var endpointReferenceEx = ((IComputeEnvironmentResource)env.Resource).GetHostAddressExpression(project.GetEndpoint("http"));
var endpointReferenceEx = env.Resource.GetHostAddressExpression(project.GetEndpoint("http"));
Assert.NotNull(endpointReferenceEx);

Assert.Equal("project1.internal.{0}", endpointReferenceEx.Format);
Expand Down
2 changes: 1 addition & 1 deletion tests/Aspire.Hosting.Docker.Tests/DockerComposeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public async Task GetHostAddressExpression()
.AddProject<Projects.ServiceA>("Project1", launchProfileName: null)
.WithHttpEndpoint();

var endpointReferenceEx = ((IComputeEnvironmentResource)env.Resource).GetHostAddressExpression(project.GetEndpoint("http"));
var endpointReferenceEx = env.Resource.GetHostAddressExpression(project.GetEndpoint("http"));
Assert.NotNull(endpointReferenceEx);

Assert.Equal("project1", endpointReferenceEx.Format);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public async Task GetHostAddressExpression()
.AddProject<Projects.ServiceA>("project1", launchProfileName: null)
.WithHttpEndpoint();

var endpointReferenceEx = ((IComputeEnvironmentResource)env.Resource).GetHostAddressExpression(project.GetEndpoint("http"));
var endpointReferenceEx = env.Resource.GetHostAddressExpression(project.GetEndpoint("http"));
Assert.NotNull(endpointReferenceEx);

Assert.Equal("project1-service", endpointReferenceEx.Format);
Expand Down
Loading