IDistributedApplicationBuilder
Interface
interface IDistributedApplicationBuilder { readonly appHostDirectory: string; readonly environment: IHostEnvironment; readonly eventing: IDistributedApplicationEventing; readonly executionContext: DistributedApplicationExecutionContext; readonly pipeline: IDistributedApplicationPipeline; readonly userSecretsManager: IUserSecretsManager; addConnectionString( name: string, environmentVariableNameOrExpression?: string | ReferenceExpression): IResourceWithConnectionString; addContainer( name: string, image: string | AddContainerOptions): ContainerResource; addContainerRegistry( name: string, endpoint: string | ParameterResource, repository?: string | ParameterResource): ContainerRegistryResource; addCSharpApp( name: string, path: string, options?: ProjectResourceOptions): CSharpAppResource; addDockerfile( name: string, contextPath: string, dockerfilePath?: string, stage?: string): ContainerResource; addDockerfileBuilder(name: string, contextPath: string, callback: (arg: DockerfileBuilderCallbackContext) => Promise<void>, stage?: string): ContainerResource; addDockerfileFactory(name: string, contextPath: string, dockerfileFactory: (arg: DockerfileFactoryContext) => Promise<string>, stage?: string): ContainerResource; addDotnetTool( name: string, packageId: string): DotnetToolResource; addEventingSubscriber(subscribe: (arg: EventingSubscriberRegistrationContext) => Promise<void>): void; addExecutable( name: string, command: string, workingDirectory: string, args: string[]): ExecutableResource; addExternalService( name: string, url: string | uri | ParameterResource): ExternalServiceResource; addHealthCheck(name: string, check: () => Promise<HealthCheckResult>): void; addParameter( name: string, value?: string, publishValueAsDefault?: boolean, secret?: boolean): ParameterResource; addParameterFromConfiguration( name: string, configurationKey: string, secret?: boolean): ParameterResource; addParameterWithGeneratedValue( name: string, value: GenerateParameterDefault, secret?: boolean, persist?: boolean): ParameterResource; addProject( name: string, projectPath: string, launchProfileOrOptions?: string | ProjectResourceOptions): ProjectResource; build(): DistributedApplication; getConfiguration(): IConfiguration; subscribeAfterPublish(callback: (arg: AfterPublishEvent) => Promise<void>): DistributedApplicationEventSubscription; subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise<void>): DistributedApplicationEventSubscription; subscribeBeforePublish(callback: (arg: BeforePublishEvent) => Promise<void>): DistributedApplicationEventSubscription; subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise<void>): DistributedApplicationEventSubscription; tryAddEventingSubscriber(subscribe: (arg: EventingSubscriberRegistrationContext) => Promise<void>): void; withOutputDiffing( targetStep?: string, diffStepName?: string, description?: string): IDistributedApplicationBuilder;}30 members
Properties
property
appHostDirectory stringgetDirectory of the project where the AppHost is located. Defaults to the content root if there's no project.
property
environmentIHostEnvironment getGets the Environment property
property
eventingIDistributedApplicationEventing getEventing infrastructure for AppHost lifecycle.
property
executionContext DistributedApplicationExecutionContext getExecution context for this invocation of the AppHost.
property
pipelineIDistributedApplicationPipeline getGets the deployment pipeline for this distributed application.
property
userSecretsManager IUserSecretsManager getGets the service for managing user secrets.
Methods
Adds a connection string resource
addConnectionString( name: string, environmentVariableNameOrExpression?: string | ReferenceExpression): IResourceWithConnectionStringParameters
namestringenvironmentVariableNameOrExpression string | ReferenceExpression optionalReturns
IResourceWithConnectionString Adds a container resource to the application.
addContainer( name: string, image: string | AddContainerOptions): ContainerResourceParameters
namestringThe name of the resource.imagestring | AddContainerOptions The image name or image options for the container.Returns
ContainerResource Adds a container registry resource
addContainerRegistry( name: string, endpoint: string | ParameterResource, repository?: string | ParameterResource): ContainerRegistryResourceParameters
namestringendpointstring | ParameterResource repositorystring | ParameterResource optionalReturns
ContainerRegistryResource Adds a C# application resource
addCSharpApp( name: string, path: string, options?: ProjectResourceOptions): CSharpAppResourceParameters
namestringpathstringoptionsProjectResourceOptions optionalReturns
CSharpAppResource Adds a Dockerfile to the application model that can be treated like a container resource.
addDockerfile( name: string, contextPath: string, dockerfilePath?: string, stage?: string): ContainerResourceParameters
namestringThe name of the resource.contextPath stringPath to be used as the context for the container image build.dockerfilePath stringoptionalPath to the Dockerfile relative to the `contextPath`. Defaults to "Dockerfile" if not specified.stagestringoptionalThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource Adds a container resource built from a programmatically generated Dockerfile
addDockerfileBuilder(name: string, contextPath: string, callback: (arg: DockerfileBuilderCallbackContext) => Promise<void>, stage?: string): ContainerResourceParameters
namestringThe name of the resource.contextPath stringPath to be used as the context for the container image build.callback(arg: DockerfileBuilderCallbackContext) => Promise<void> A callback that uses the `DockerfileBuilder` API to construct the Dockerfile.stagestringoptionalThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource Adds a Dockerfile to the application model that can be treated like a container resource, with the Dockerfile content generated by an asynchronous factory function.
addDockerfileFactory(name: string, contextPath: string, dockerfileFactory: (arg: DockerfileFactoryContext) => Promise<string>, stage?: string): ContainerResourceParameters
namestringThe name of the resource.contextPath stringPath to be used as the context for the container image build.dockerfileFactory (arg: DockerfileFactoryContext) => Promise<string> An asynchronous function that returns the Dockerfile content as a string.stagestringoptionalThe stage representing the image to be published in a multi-stage Dockerfile.Returns
ContainerResource Adds a .NET tool resource to the application model.
addDotnetTool( name: string, packageId: string): DotnetToolResourceParameters
namestringThe name of the resource.packageId stringThe package id of the tool.Returns
DotnetToolResource method
addEventingSubscriber Adds an ATS-friendly eventing subscriber callback to the distributed-application builder.
addEventingSubscriber(subscribe: (arg: EventingSubscriberRegistrationContext) => Promise<void>): voidParameters
subscribe(arg: EventingSubscriberRegistrationContext) => Promise<void> The callback that registers the event subscriptions.Adds an executable resource to the application model.
addExecutable( name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourceParameters
namestringThe name of the resource.commandstringThe executable path. This can be a fully qualified path or a executable to run from the shell/command line.workingDirectory stringThe working directory of the executable.argsstring[]The arguments to the executable.Returns
ExecutableResource Adds an external service resource
addExternalService( name: string, url: string | uri | ParameterResource): ExternalServiceResourceParameters
namestringurlstring | uri | ParameterResource Returns
ExternalServiceResource method
addHealthCheck Adds a custom health check callback to the distributed-application builder.
addHealthCheck(name: string, check: () => Promise<HealthCheckResult>): voidParameters
namestringThe health check registration name.check() => Promise<HealthCheckResult> The callback that evaluates the health check.Adds a parameter resource
addParameter( name: string, value?: string, publishValueAsDefault?: boolean, secret?: boolean): ParameterResourceParameters
namestringvaluestringoptionalpublishValueAsDefault booleanoptional= Falsesecretbooleanoptional= FalseReturns
ParameterResource Adds a parameter resource to the application, with a value coming from configuration.
addParameterFromConfiguration( name: string, configurationKey: string, secret?: boolean): ParameterResourceParameters
namestringName of parameter resourceconfigurationKey stringConfiguration key used to get the value of the parametersecretbooleanoptional= FalseOptional flag indicating whether the parameter should be regarded as secret.Returns
ParameterResource Adds a parameter with a generated default value
addParameterWithGeneratedValue( name: string, value: GenerateParameterDefault, secret?: boolean, persist?: boolean): ParameterResourceParameters
namestringvalueGenerateParameterDefault secretbooleanoptional= Falsepersistbooleanoptional= FalseReturns
ParameterResource Adds a .NET project resource
addProject( name: string, projectPath: string, launchProfileOrOptions?: string | ProjectResourceOptions): ProjectResourceParameters
namestringprojectPath stringlaunchProfileOrOptions string | ProjectResourceOptions optionalReturns
ProjectResource method
buildBuilds the distributed application
build(): DistributedApplicationReturns
DistributedApplication method
getConfiguration Gets the application configuration.
getConfiguration(): IConfigurationReturns
IConfiguration method
subscribeAfterPublish Subscribes to the AfterPublish event, which fires after the application is published.
subscribeAfterPublish(callback: (arg: AfterPublishEvent) => Promise<void>): DistributedApplicationEventSubscriptionParameters
callback(arg: AfterPublishEvent) => Promise<void> A callback that receives the exported event when the event fires.Returns
DistributedApplicationEventSubscription Subscribes to the AfterResourcesCreated event, which fires after all resources are created.
subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise<void>): DistributedApplicationEventSubscriptionParameters
callback(arg: AfterResourcesCreatedEvent) => Promise<void> A callback that receives the exported event when the event fires.Returns
DistributedApplicationEventSubscription method
subscribeBeforePublish Subscribes to the BeforePublish event, which fires before the application is published.
subscribeBeforePublish(callback: (arg: BeforePublishEvent) => Promise<void>): DistributedApplicationEventSubscriptionParameters
callback(arg: BeforePublishEvent) => Promise<void> A callback that receives the exported event when the event fires.Returns
DistributedApplicationEventSubscription method
subscribeBeforeStart Subscribes to the BeforeStart event, which fires before the application starts.
subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise<void>): DistributedApplicationEventSubscriptionParameters
callback(arg: BeforeStartEvent) => Promise<void> A callback that receives the exported event when the event fires.Returns
DistributedApplicationEventSubscription method
tryAddEventingSubscriber Attempts to add an ATS-friendly eventing subscriber callback to the distributed-application builder.
tryAddEventingSubscriber(subscribe: (arg: EventingSubscriberRegistrationContext) => Promise<void>): voidParameters
subscribe(arg: EventingSubscriberRegistrationContext) => Promise<void> The callback that registers the event subscriptions.method
withOutputDiffing Adds an opt-in target that checks for stale generated pipeline output.
withOutputDiffing( targetStep?: string, diffStepName?: string, description?: string): IDistributedApplicationBuilderParameters
targetStep stringoptional= publishThe step whose completed output is compared. Defaults to `publish`.diffStepName stringoptionalThe comparison target name. When null, uses the target name followed by `-and-diff`.descriptionstringoptionalAn optional description of the comparison target.Returns
IDistributedApplicationBuilder