Skip to content

[13.2] Document new contextual endpoint resolution apis. #366

@afscrome

Description

@afscrome

You can now resolve endpoints from the perspective of specific resources. Depending on your ocnext, the same resource could be http://host.docker.internal:1234, http://localhost:1234 or http://resource.dev.internal:4567 depending on where you resolved it from.

var endpoint = redis.GetEndpoint("tcp")
var url = await endpoint.GetValueAsync(new ValueProviderContext {
    Caller = containerApp.Resource,
});

You can also resolve the url from the perspective of a specific network:

var endpoint = redis.GetEndpoint("tcp")
var url = await endpoint.GetValueAsync(new ValueProviderContext {
    Network = KnownNetworkIdentifiers.DefaultAspireContainerNetwork
});

(Note, the APIs for this all existed in 13.1, they just didn't behave as you'd expect them to)

References:

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions