Skip to content
Docs Try Aspire

ResourceExtensions

Class static net10.0
📦 Aspire.Hosting v13.1.2
Provides extension methods for the IResource interface.
namespace Aspire.Hosting.ApplicationModel;
public static class ResourceExtensions
{
// ...
}
GetArgumentValuesAsync(IResourceWithArgs, DistributedApplicationOperation)extensionobsolete
ValueTask<string[]>
Get the arguments from the given resource.
GetDeploymentTargetAnnotation(IResource, IComputeEnvironmentResource?)extension
Gets the deployment target for the specified resource, if any. Throws an exception if there are multiple compute environments and a compute environment is not explicitly specified.
GetEndpoint(IResourceWithEndpoints, string)extension
Gets an endpoint reference for the specified endpoint name.
GetEndpoint(IResourceWithEndpoints, string, NetworkIdentifier)extension
Gets an endpoint reference for the specified endpoint name.
GetEndpoints(IResourceWithEndpoints)extension
Gets references to all endpoints for the specified resource.
GetEndpoints(IResourceWithEndpoints, NetworkIdentifier)extension
Gets references to all endpoints for the specified resource.
GetEnvironmentVariableValuesAsync(IResourceWithEnvironment, DistributedApplicationOperation)extensionobsolete
ValueTask<Dictionary<string, string>>
Get the environment variables from the given resource.
GetReplicaCount(IResource)extension
int
HasAnnotationIncludingAncestorsOfType(IResource)extension
bool
Gets whether resource or its ancestors have an annotation of type T
HasAnnotationOfType(IResource)extension
bool
Gets whether resource has an annotation of type T
IsExcludedFromPublish(IResource)extension
bool
Gets a value indicating whether the resource is excluded from being published.
ProcessArgumentValuesAsync(IResource, DistributedApplicationExecutionContext, Action<object?, string?, Exception?, bool>, ILogger, CancellationToken)extensionobsolete
ValueTask
Processes argument values for the specified resource in the given execution context.
ProcessEnvironmentVariableValuesAsync(IResource, DistributedApplicationExecutionContext, Action<string, object?, string?, Exception?>, ILogger, CancellationToken)extensionobsolete
ValueTask
Processes environment variable values for the specified resource within the given execution context.
RequiresImageBuild(IResource)extension
bool
Determines whether the specified resource requires image building.
RequiresImageBuildAndPush(IResource)extension
bool
Determines whether the specified resource requires image building and pushing.
ResolveEndpoints(IResource, IPortAllocator?)extension
Resolves endpoint port configuration for the specified resource. Computes target ports and exposed ports based on resource type, endpoint configuration, and whether the endpoint is considered a default HTTP endpoint.
TryGetAnnotationsIncludingAncestorsOfType(IResource, IEnumerable<T>)extension
bool
Attempts to retrieve all annotations of the specified type from the given resource including from parents.
TryGetAnnotationsOfType(IResource, IEnumerable<T>)extension
bool
Attempts to retrieve all annotations of the specified type from the given resource.
TryGetContainerImageName(IResource, string?)extension
bool
Attempts to get the container image name from the given resource.
TryGetContainerImageName(IResource, bool, string?)extension
bool
Attempts to get the container image name from the given resource.
TryGetContainerMounts(IResource, IEnumerable<ContainerMountAnnotation>)extension
bool
Attempts to get the container mounts for the specified resource.
TryGetEndpoints(IResource, IEnumerable<EndpointAnnotation>)extension
bool
Attempts to retrieve the endpoints for the given resource.
TryGetEnvironmentVariables(IResource, IEnumerable<EnvironmentCallbackAnnotation>)extension
bool
Attempts to get the environment variables from the given resource.
TryGetLastAnnotation(IResource, T?)extension
bool
Attempts to get the last annotation of the specified type from the resource.
TryGetUrls(IResource, IEnumerable<ResourceUrlAnnotation>)extension
bool
Attempts to retrieve the URLs for the given resource.
WithContainerBuildOptions(IResourceBuilder<T>, Action<ContainerBuildOptionsCallbackContext>)extensionexperimental
Configures container build options for a compute resource using a callback.
WithContainerBuildOptions(IResourceBuilder<T>, Func<ContainerBuildOptionsCallbackContext, Task>)extensionexperimental
Configures container build options for a compute resource using an async callback.
View all methods