ResourceExtensions
Class static net10.0
Provides extension methods for the
IResource interface. namespace Aspire.Hosting.ApplicationModel;
public static class ResourceExtensions{ // ...} 27 members
Methods27
Section titled MethodsGetArgumentValuesAsync(IResourceWithArgs, DistributedApplicationOperation)extensionobsoleteValueTask<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)extensionobsoleteValueTask<Dictionary<string, string>> Get the environment variables from the given resource.
GetReplicaCount(IResource)extensionint Gets the number of replicas for the specified resource. Defaults to
1 if no ReplicaAnnotation is found. HasAnnotationIncludingAncestorsOfType(IResource)extensionbool Gets whether
resource or its ancestors have an annotation of type THasAnnotationOfType(IResource)extensionbool Gets whether
resource has an annotation of type TIsExcludedFromPublish(IResource)extensionbool 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.
ProcessEnvironmentVariableValuesAsync(IResource, DistributedApplicationExecutionContext, Action<string, object?, string?, Exception?>, ILogger, CancellationToken)extensionobsoleteValueTask Processes environment variable values for the specified resource within the given execution context.
RequiresImageBuild(IResource)extensionbool Determines whether the specified resource requires image building.
RequiresImageBuildAndPush(IResource)extensionbool 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>)extensionbool Attempts to retrieve all annotations of the specified type from the given resource including from parents.
TryGetAnnotationsOfType(IResource, IEnumerable<T>)extensionbool Attempts to retrieve all annotations of the specified type from the given resource.
TryGetContainerImageName(IResource, string?)extensionbool Attempts to get the container image name from the given resource.
TryGetContainerImageName(IResource, bool, string?)extensionbool Attempts to get the container image name from the given resource.
TryGetContainerMounts(IResource, IEnumerable<ContainerMountAnnotation>)extensionbool Attempts to get the container mounts for the specified resource.
TryGetEndpoints(IResource, IEnumerable<EndpointAnnotation>)extensionbool Attempts to retrieve the endpoints for the given resource.
TryGetEnvironmentVariables(IResource, IEnumerable<EnvironmentCallbackAnnotation>)extensionbool Attempts to get the environment variables from the given resource.
TryGetLastAnnotation(IResource, T?)extensionbool Attempts to get the last annotation of the specified type from the resource.
TryGetUrls(IResource, IEnumerable<ResourceUrlAnnotation>)extensionbool 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.