-
Notifications
You must be signed in to change notification settings - Fork 760
Closed
Labels
area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
In the WithUrls callback, you probably want access to endpoints on the resource, however ctx.Resource is typed as IResource not IResourceWithEndpoints so you've got to go through a bit of casting, or go through `TryGetEndpoints' a bit awkward to get
.WithUrls(ctx =>
{
var endpoint = ((IResourceWithEndpoints)ctx.Resource).GetEndpoint("http");
//or
if(ctx.Resource.TryGetEndpoints(out var endpoints))
{
var endpoint2 = endpoints.Single(x => x.Name == "http");
}
ctx.Urls.Add(new ResourceUrlAnnotation {
Url = $"{endpoint.Url}/swagger",
DisplayText = "swagger",
Endpoint = endpoint
});
})Describe the solution you'd like
It would be nice if there was an easier way to get an endpoint in this callback, perhaps
.WithUrls(ctx =>
{
var endpoint = ctx.GetEndpoint("http");
// ...
})Additional context
Metadata
Metadata
Assignees
Labels
area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication