ResourceExtensions
Classstaticnet10.0
Provides extension methods for the
IResource interface. namespace Aspire.Hosting.ApplicationModel;
public static class ResourceExtensions{ // ...}30 members
Methods30
Section titled MethodsValueTask<string[]> Get the arguments from the given resource.
Gets the compute environment that the resource is explicitly bound to, if any.
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.
Gets an endpoint reference for the specified endpoint name.
Gets an endpoint reference for the specified endpoint name.
Gets references to all endpoints for the specified resource.
Gets references to all endpoints for the specified resource.
GetEnvironmentVariableValuesAsync(IResourceWithEnvironment, DistributedApplicationOperation)extensionobsoleteValueTask<Dictionary<string, string>> Get the environment variables from the given resource.
int Gets the number of replicas for the specified resource. Defaults to
1 if no ReplicaAnnotation is found. GetResourceDependenciesAsync(IResource, DistributedApplicationExecutionContext, ResourceDependencyDiscoveryMode, CancellationToken)extensionats ignored Computes the set of resources that the specified
resource depends on. GetResourceDependenciesAsync(IResource, DistributedApplicationExecutionContext, ResourceDependencyDiscoveryOptions, CancellationToken)extensionats ignored Computes the set of resources that the specified
resource depends on. bool Gets whether
resource or its ancestors have an annotation of type Tbool Gets whether
resource has an annotation of type Tbool Gets a value indicating whether the resource is excluded from being published.
ProcessArgumentValuesAsync(IResource, DistributedApplicationExecutionContext, Action<object?, string?, Exception?, bool>, ILogger, CancellationToken)extensionobsoleteValueTask Processes argument values for the specified resource in the given execution context.
ValueTask Processes environment variable values for the specified resource within the given execution context.
bool Determines whether the specified resource requires image building.
bool Determines whether the specified resource requires image building and pushing.
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.
bool Attempts to retrieve all annotations of the specified type from the given resource including from parents.
bool Attempts to retrieve all annotations of the specified type from the given resource.
bool Attempts to get the container image name from the given resource.
bool Attempts to get the container image name from the given resource.
bool Attempts to get the container mounts for the specified resource.
bool Attempts to retrieve the endpoints for the given resource.
TryGetEnvironmentVariables(IResource, IEnumerable<EnvironmentCallbackAnnotation>)extensionats ignoredbool Attempts to get the environment variables from the given resource.
bool Attempts to get the last annotation of the specified type from the resource.
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 export Configures container build options for a compute resource using an async callback.