Skip to content
Docs Try Aspire

ResourceExtensions

Class static net8.0
📦 Aspire.Hosting v13.2.0
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.
GetComputeEnvironment(IResource)extensionats ignored
Gets the compute environment that the resource is explicitly bound to, if any.
GetDeploymentTargetAnnotation(IResource, IComputeEnvironmentResource?)extensionats ignored
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)extensionats ignored
Gets an endpoint reference for the specified endpoint name.
GetEndpoint(IResourceWithEndpoints, string, NetworkIdentifier)extensionats ignored
Gets an endpoint reference for the specified endpoint name.
GetEndpoints(IResourceWithEndpoints)extensionats ignored
Gets references to all endpoints for the specified resource.
GetEndpoints(IResourceWithEndpoints, NetworkIdentifier)extensionats ignored
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)extensionats ignored
int
GetResourceDependenciesAsync(IResource, DistributedApplicationExecutionContext, ResourceDependencyDiscoveryMode, CancellationToken)extensionats ignored
Computes the set of resources that the specified resource depends on.
HasAnnotationIncludingAncestorsOfType(IResource)extensionats ignored
bool
Gets whether resource or its ancestors have an annotation of type T
HasAnnotationOfType(IResource)extensionats ignored
bool
Gets whether resource has an annotation of type T
IsExcludedFromPublish(IResource)extensionats ignored
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)extensionats ignored
bool
Determines whether the specified resource requires image building.
RequiresImageBuildAndPush(IResource)extensionats ignored
bool
Determines whether the specified resource requires image building and pushing.
ResolveEndpoints(IResource, IPortAllocator?)extensionats ignored
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>)extensionats ignored
bool
Attempts to retrieve all annotations of the specified type from the given resource including from parents.
TryGetAnnotationsOfType(IResource, IEnumerable<T>)extensionats ignored
bool
Attempts to retrieve all annotations of the specified type from the given resource.
TryGetContainerImageName(IResource, string?)extensionats ignored
bool
Attempts to get the container image name from the given resource.
TryGetContainerImageName(IResource, bool, string?)extensionats ignored
bool
Attempts to get the container image name from the given resource.
TryGetContainerMounts(IResource, IEnumerable<ContainerMountAnnotation>)extensionats ignored
bool
Attempts to get the container mounts for the specified resource.
TryGetEndpoints(IResource, IEnumerable<EndpointAnnotation>)extensionats ignored
bool
Attempts to retrieve the endpoints for the given resource.
TryGetEnvironmentVariables(IResource, IEnumerable<EnvironmentCallbackAnnotation>)extensionats ignored
bool
Attempts to get the environment variables from the given resource.
TryGetLastAnnotation(IResource, T?)extensionats ignored
bool
Attempts to get the last annotation of the specified type from the resource.
TryGetUrls(IResource, IEnumerable<ResourceUrlAnnotation>)extensionats ignored
bool
Attempts to retrieve the URLs for the given resource.
WithContainerBuildOptions(IResourceBuilder<T>, Action<ContainerBuildOptionsCallbackContext>)extensionexperimentalats ignored
Configures container build options for a compute resource using a callback.
WithContainerBuildOptions(IResourceBuilder<T>, Func<ContainerBuildOptionsCallbackContext, Task>)extensionexperimentalats ignored
Configures container build options for a compute resource using an async callback.
View all methods