IResource
Interface
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; withHidden(): IResource; withHiddenOnCompletion( exitCode?: number, exitCodes?: number[]): IResource; withIconName( iconName: string, iconVariant?: IconVariant): IResource; withLifetimeOf(sourceBuilder: IResource): IResource; withParentProcessLifetime(parentProcessId: number): IResource; withParentRelationship(parent: IResource): IResource; withPersistentLifetime(): 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; withProcessCommand( commandName: string, displayName: string, options: ProcessCommandExportOptions): IResource; withProcessCommandFactory(commandName: string, displayName: string, createProcessSpec: (arg: ExecuteCommandContext) => Promise<ProcessCommandSpecExportData>, options?: ProcessCommandResultExportOptions): IResource; withRelationship( resourceBuilder: IResource, type: string): IResource; withRequiredCommand( command: string, helpLink?: string): IResource; withSessionLifetime(): IResource; withUrl( url: ReferenceExpression, displayText?: string): IResource; withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise<void>): IResource; withUrls(callback: (obj: ResourceUrlsCallbackContext) => Promise<void>): IResource;}31 members
Methods
Creates an execution configuration builder for the specified resource.
createExecutionConfiguration(): IExecutionConfigurationBuilderReturns
IExecutionConfigurationBuilderExcludes a resource from being published to the manifest.
excludeFromManifest(): IResourceReturns
IResourceExclude the resource from MCP operations using the Aspire MCP server. The resource is excluded from results that return resources, console logs and telemetry.
excludeFromMcp(): IResourceReturns
IResourcemethod
getResourceNameGets the name of the resource from a builder.
getResourceName(): stringReturns
stringSubscribes to the BeforeResourceStarted event.
onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise<void>): IResourceParameters
callback(arg: BeforeResourceStartedEvent) => Promise<void>Returns
IResourceSubscribes to the InitializeResource event.
onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise<void>): IResourceParameters
callback(arg: InitializeResourceEvent) => Promise<void>Returns
IResourceSubscribes to the ResourceReady event.
onResourceReady(callback: (arg: ResourceReadyEvent) => Promise<void>): IResourceParameters
callback(arg: ResourceReadyEvent) => Promise<void>Returns
IResourceSubscribes to the ResourceStopped event.
onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise<void>): IResourceParameters
callback(arg: ResourceStoppedEvent) => Promise<void>Returns
IResourceSets a child relationship
withChildRelationship(child: IResource): IResourceParameters
childIResourceReturns
IResourceAdds a resource command
withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>, commandOptions?: CommandOptions): IResourceParameters
namestringdisplayNamestringexecuteCommand(arg: ExecuteCommandContext) => Promise<ExecuteCommandResult>commandOptionsCommandOptionsoptionalReturns
IResourceConfigures the resource to use the specified container registry for container image operations.
withContainerRegistry(registry: IResource): IResourceParameters
registryIResourceReturns
IResourceConfigures custom base images for generated Dockerfiles.
withDockerfileBaseImage( buildImage?: string, runtimeImage?: string): IResourceParameters
buildImagestringoptionalruntimeImagestringoptionalReturns
IResourcePrevents resource from starting automatically
withExplicitStart(): IResourceReturns
IResourceAdds a health check by key
withHealthCheck(key: string): IResourceParameters
keystringReturns
IResourceSpecifies the icon to use when displaying the resource in the dashboard.
withIconName( iconName: string, iconVariant?: IconVariant): IResourceParameters
iconNamestringiconVariantIconVariantoptional= FilledReturns
IResourceConfigures a resource to match the lifetime of another resource.
withLifetimeOf(sourceBuilder: IResource): IResourceParameters
sourceBuilderIResourceReturns
IResourceConfigures a resource to use a persistent lifetime that ends when a parent process exits.
withParentProcessLifetime(parentProcessId: number): IResourceParameters
parentProcessIdnumberReturns
IResourceSets the parent relationship
withParentRelationship(parent: IResource): IResourceParameters
parentIResourceReturns
IResourceConfigures a resource to use a persistent lifetime.
withPersistentLifetime(): IResourceReturns
IResourceRegisters a callback to be executed during the pipeline configuration phase, allowing modification of step dependencies and relationships.
withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise<void>): IResourceParameters
callback(obj: PipelineConfigurationContext) => Promise<void>Returns
IResourceAdds a pipeline step to the resource that will be executed during deployment.
withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise<void>, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): IResourceParameters
stepNamestringcallback(arg: PipelineStepContext) => Promise<void>dependsOnstring[]optionalrequiredBystring[]optionaltagsstring[]optionaldescriptionstringoptionalReturns
IResourceAdds a command to the resource that starts a local process when invoked.
withProcessCommand( commandName: string, displayName: string, options: ProcessCommandExportOptions): IResourceParameters
commandNamestringdisplayNamestringoptionsProcessCommandExportOptionsReturns
IResourceAdds a command to the resource that starts a local process created by a callback when invoked.
withProcessCommandFactory(commandName: string, displayName: string, createProcessSpec: (arg: ExecuteCommandContext) => Promise<ProcessCommandSpecExportData>, options?: ProcessCommandResultExportOptions): IResourceParameters
commandNamestringdisplayNamestringcreateProcessSpec(arg: ExecuteCommandContext) => Promise<ProcessCommandSpecExportData>optionsProcessCommandResultExportOptionsoptionalReturns
IResourceAdds a relationship to another resource using its builder.
withRelationship( resourceBuilder: IResource, type: string): IResourceParameters
resourceBuilderIResourcetypestringReturns
IResourceDeclares that a resource requires a specific command/executable to be available on the local machine PATH before it can start.
withRequiredCommand( command: string, helpLink?: string): IResourceParameters
commandstringhelpLinkstringoptionalReturns
IResourceConfigures a resource to use a session lifetime.
withSessionLifetime(): IResourceReturns
IResourceAdds or modifies displayed URLs
withUrl( url: ReferenceExpression, displayText?: string): IResourceParameters
urlReferenceExpressiondisplayTextstringoptionalReturns
IResourceRegisters a callback to update the URL displayed for the endpoint with the specified name.
withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise<void>): IResourceParameters
endpointNamestringcallback(obj: ResourceUrlAnnotation) => Promise<void>Returns
IResourceRegisters a callback to customize the URLs displayed for the resource.
withUrls(callback: (obj: ResourceUrlsCallbackContext) => Promise<void>): IResourceParameters
callback(obj: ResourceUrlsCallbackContext) => Promise<void>Returns
IResource