Skip to content
Docs Try Aspire
Docs Try

IResource

Interface
📦 Aspire.Hosting v13.3.0
interface IResource {
createExecutionConfiguration(): IExecutionConfigurationBuilder;
excludeFromManifest(): IResource;
excludeFromMcp(): IResource;
getResourceName(): string;
onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise<void>): IResource;
onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise<void>): IResource;
onResourceReady(callback: (arg: ResourceReadyEvent) => Promise<void>): IResource;
onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise<void>): IResource;
withChildRelationship(child: IResource): IResource;
withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>, commandOptions?: CommandOptions): IResource;
withContainerRegistry(registry: IResource): IResource;
withDockerfileBaseImage(
buildImage?: string,
runtimeImage?: string): IResource;
withExplicitStart(): IResource;
withHealthCheck(key: string): IResource;
withIconName(
iconName: string,
iconVariant?: IconVariant): IResource;
withParentRelationship(parent: IResource): IResource;
withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise<void>): IResource;
withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise<void>, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): IResource;
withRelationship(
resourceBuilder: IResource,
type: string): IResource;
withRequiredCommand(
command: string,
helpLink?: string): IResource;
withUrl(
url: ReferenceExpression,
displayText?: string): IResource;
withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise<void>): IResource;
withUrls(callback: (obj: ResourceUrlsCallbackContext) => Promise<void>): IResource;
}

Methods

Creates an execution configuration builder
createExecutionConfiguration(): IExecutionConfigurationBuilder
IExecutionConfigurationBuilder
method excludeFromManifest builder
Excludes the resource from the deployment manifest
excludeFromManifest(): IResource
IResource
method excludeFromMcp builder
Excludes the resource from MCP server exposure
excludeFromMcp(): IResource
IResource
Gets the resource name
getResourceName(): string
string
Subscribes to the BeforeResourceStarted event
onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise<void>): IResource
callback (arg: BeforeResourceStartedEvent) => Promise<void>
IResource
method onInitializeResource builder
Subscribes to the InitializeResource event
onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise<void>): IResource
callback (arg: InitializeResourceEvent) => Promise<void>
IResource
method onResourceReady builder
Subscribes to the ResourceReady event
onResourceReady(callback: (arg: ResourceReadyEvent) => Promise<void>): IResource
callback (arg: ResourceReadyEvent) => Promise<void>
IResource
method onResourceStopped builder
Subscribes to the ResourceStopped event
onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise<void>): IResource
callback (arg: ResourceStoppedEvent) => Promise<void>
IResource
Sets a child relationship
withChildRelationship(child: IResource): IResource
child IResource
IResource
method withCommand builder
Adds a resource command
withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>, commandOptions?: CommandOptions): IResource
name string
displayName string
executeCommand (arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>
commandOptions CommandOptions optional
IResource
Configures a resource to use a container registry
withContainerRegistry(registry: IResource): IResource
registry IResource
IResource
Sets the base image for a Dockerfile build
withDockerfileBaseImage(
buildImage?: string,
runtimeImage?: string): IResource
buildImage string optional
runtimeImage string optional
IResource
method withExplicitStart builder
Prevents resource from starting automatically
withExplicitStart(): IResource
IResource
method withHealthCheck builder
Adds a health check by key
withHealthCheck(key: string): IResource
key string
IResource
method withIconName builder
Sets the icon for the resource
withIconName(
iconName: string,
iconVariant?: IconVariant): IResource
iconName string
iconVariant IconVariant optional = Filled
IResource
Sets the parent relationship
withParentRelationship(parent: IResource): IResource
parent IResource
IResource
Configures pipeline step dependencies via a callback
withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise<void>): IResource
callback (obj: PipelineConfigurationContext) => Promise<void>
IResource
Adds a pipeline step to the resource
withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise<void>, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): IResource
stepName string
callback (arg: PipelineStepContext) => Promise<void>
dependsOn string[] optional
requiredBy string[] optional
tags string[] optional
description string optional
IResource
method withRelationship builder
Adds a relationship to another resource
withRelationship(
resourceBuilder: IResource,
type: string): IResource
resourceBuilder IResource
type string
IResource
method withRequiredCommand builder
Adds a required command dependency
withRequiredCommand(
command: string,
helpLink?: string): IResource
command string
helpLink string optional
IResource
method withUrl builder
Adds or modifies displayed URLs
withUrl(
url: ReferenceExpression,
displayText?: string): IResource
url ReferenceExpression
displayText string optional
IResource
method withUrlForEndpoint builder
Customizes the URL for a specific endpoint via callback
withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise<void>): IResource
endpointName string
callback (obj: ResourceUrlAnnotation) => Promise<void>
IResource
method withUrls builder
Customizes displayed URLs via callback
withUrls(callback: (obj: ResourceUrlsCallbackContext) => Promise<void>): IResource
callback (obj: ResourceUrlsCallbackContext) => Promise<void>
IResource