Share via


IResourceBuilder<T> Interface

Definition

Defines a builder for creating resources of type T.

public interface IResourceBuilder<out T> where T : IResource
type IResourceBuilder<'T (requires 'T :> IResource)> = interface
Public Interface IResourceBuilder(Of Out T)

Type Parameters

T

The type of resource to build.

This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.

Properties

ApplicationBuilder

Gets the distributed application builder associated with this resource builder.

Resource

Gets the resource of type T that is being built.

Methods

WithAnnotation<TAnnotation>(ResourceAnnotationMutationBehavior)

Adds an annotation to the resource being built.

WithAnnotation<TAnnotation>(TAnnotation, ResourceAnnotationMutationBehavior)

Adds an annotation to the resource being built.

Extension Methods

WithEnvironment<T>(IResourceBuilder<T>, String, BicepOutputReference)

Adds an environment variable to the resource with the value of the output from the bicep template.

WithEnvironment<T>(IResourceBuilder<T>, String, BicepSecretOutputReference)

Adds an environment variable to the resource with the value of the secret output from the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, IResourceBuilder<IResourceWithConnectionString>)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, IResourceBuilder<ParameterResource>)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, ParameterResource)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, BicepOutputReference)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, IEnumerable<String>)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, Func<Object>)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, String)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String, JsonNode)

Adds a parameter to the bicep template.

WithParameter<T>(IResourceBuilder<T>, String)

Adds a parameter to the bicep template.

ConfigureConstruct<T>(IResourceBuilder<T>, Action<ResourceModuleConstruct>)

Configures the Azure construct resource.

PublishAsConnectionString<T>(IResourceBuilder<T>)

Changes the resource to be published as a connection string reference in the manifest.

WithEnvironment<T>(IResourceBuilder<T>, String, StackOutputReference)

Adds an environment variable to the resource with the value of the output from the CloudFormation stack.

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<ICloudFormationResource>, String)

Add a reference of a CloudFormations stack to a project. The output parameters of the CloudFormation stack are added to the project IConfiguration.

PublishAsContainer<T>(IResourceBuilder<T>)

Changes the resource to be published as a container in the manifest.

WithBindMount<T>(IResourceBuilder<T>, String, String, Boolean)

Adds a bind mount to a container resource.

WithBuildArg<T>(IResourceBuilder<T>, String, IResourceBuilder<ParameterResource>)

Adds a build argument when the container is built from a Dockerfile.

WithBuildArg<T>(IResourceBuilder<T>, String, Object)

Adds a build argument when the container is build from a Dockerfile.

WithBuildSecret<T>(IResourceBuilder<T>, String, IResourceBuilder<ParameterResource>)

Adds a secret build argument when the container is built from a Dockerfile.

WithContainerRuntimeArgs<T>(IResourceBuilder<T>, Action<ContainerRuntimeArgsCallbackContext>)

Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.

WithContainerRuntimeArgs<T>(IResourceBuilder<T>, Func<ContainerRuntimeArgsCallbackContext,Task>)

Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.

WithContainerRuntimeArgs<T>(IResourceBuilder<T>, String[])

Adds a callback to be executed with a list of arguments to add to the container runtime run command when a container resource is started.

WithDockerfile<T>(IResourceBuilder<T>, String, String, String)

Causes .NET Aspire to build the specified container image from a Dockerfile.

WithEntrypoint<T>(IResourceBuilder<T>, String)

Sets the Entrypoint for the container.

WithImage<T>(IResourceBuilder<T>, String, String)

Allows overriding the image on a container.

WithImageRegistry<T>(IResourceBuilder<T>, String)

Allows overriding the image registry on a container.

WithImageSHA256<T>(IResourceBuilder<T>, String)

Allows setting the image to a specific sha256 on a container.

WithImageTag<T>(IResourceBuilder<T>, String)

Allows overriding the image tag on a container.

WithVolume<T>(IResourceBuilder<T>, String, String, Boolean)

Adds a volume to a container resource.

WithVolume<T>(IResourceBuilder<T>, String)

Adds an anonymous volume to a container resource.

WithInitialState<TResource>(IResourceBuilder<TResource>, CustomResourceSnapshot)

Initializes the resource with the initial snapshot.

PublishAsDockerFile<T>(IResourceBuilder<T>, IEnumerable<DockerBuildArg>)

Adds annotation to ExecutableResource to support containerization during deployment. The resulting container image is built, and when the optional buildArgs are provided they're used with docker build --build-arg.

WithDaprSidecar<T>(IResourceBuilder<T>, DaprSidecarOptions)

Ensures that a Dapr sidecar is started for the resource.

WithDaprSidecar<T>(IResourceBuilder<T>, Action<IResourceBuilder<IDaprSidecarResource>>)

Ensures that a Dapr sidecar is started for the resource.

WithDaprSidecar<T>(IResourceBuilder<T>, String)

Ensures that a Dapr sidecar is started for the resource.

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IDaprComponentResource>)

Associates a Dapr component with the Dapr sidecar started for the resource.

WithAttu<T>(IResourceBuilder<T>, Action<IResourceBuilder<AttuResource>>, String)

Adds an administration and development platform for Milvus to the application model using Attu. This version the package defaults to the 2.3-latest tag of the attu container image

WithMongoExpress<T>(IResourceBuilder<T>, Action<IResourceBuilder<MongoExpressContainerResource>>, String)

Adds a MongoExpress administration and development platform for MongoDB to the application model. This version the package defaults to the 1.0.2-20 tag of the mongo-express container image

WithPhpMyAdmin<T>(IResourceBuilder<T>, Action<IResourceBuilder<PhpMyAdminContainerResource>>, String)

Adds a phpMyAdmin administration and development platform for MySql to the application model. This version the package defaults to the 5.2 tag of the phpmyadmin container image

WithReference<T>(IResourceBuilder<T>, OrleansServiceClient)

Adds an Orleans client to the resource.

WithReference<T>(IResourceBuilder<T>, OrleansService)

Adds Orleans to the resource.

WithOtlpExporter<T>(IResourceBuilder<T>)

Injects the appropriate environment variables to allow the resource to enable sending telemetry to the dashboard.

  1. It sets the OTLP endpoint to the value of the DOTNET_DASHBOARD_OTLP_ENDPOINT_URL environment variable.
  2. It sets the service name and instance id to the resource name and UID. Values are injected by the orchestrator.
  3. It sets a small batch schedule delay in development. This reduces the delay that OTLP exporter waits to sends telemetry and makes the dashboard telemetry pages responsive.
PublishAsConnectionString<T>(IResourceBuilder<T>)

Changes the resource to be published as a connection string reference in the manifest.

WithPgAdmin<T>(IResourceBuilder<T>, Action<IResourceBuilder<PgAdminContainerResource>>, String)

Adds a pgAdmin 4 administration and development platform for PostgreSQL to the application model. This version the package defaults to the 8.8 tag of the dpage/pgadmin4 container image

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<QdrantServerResource>)

Add a reference to a Qdrant server to the resource.

AsHttp2Service<T>(IResourceBuilder<T>)

Configures a resource to mark all endpoints' transport as HTTP/2. This is useful for HTTP/2 services that need prior knowledge.

ExcludeFromManifest<T>(IResourceBuilder<T>)

Excludes a resource from being published to the manifest.

GetEndpoint<T>(IResourceBuilder<T>, String)

Gets an EndpointReference by name from the resource. These endpoints are declared either using WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>) or by launch settings (for project resources). The EndpointReference can be used to resolve the address of the endpoint in WithEnvironment<T>(IResourceBuilder<T>, Action<EnvironmentCallbackContext>).

WithArgs<T>(IResourceBuilder<T>, Action<CommandLineArgsCallbackContext>)

Adds a callback to be executed with a list of command-line arguments when a container resource is started.

WithArgs<T>(IResourceBuilder<T>, Func<CommandLineArgsCallbackContext,Task>)

Adds a callback to be executed with a list of command-line arguments when a container resource is started.

WithArgs<T>(IResourceBuilder<T>, String[])

Adds the arguments to be passed to a container resource when the container is started.

WithConnectionStringRedirection<T>(IResourceBuilder<T>, IResourceWithConnectionString)

Registers a callback which is invoked when a connection string is requested for a resource.

WithEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, String, Boolean, Nullable<Boolean>)

Exposes an endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be the scheme name if not specified.

WithEndpoint<T>(IResourceBuilder<T>, String, Action<EndpointAnnotation>, Boolean)

Changes an existing creates a new endpoint if it doesn't exist and invokes callback to modify the defaults.

WithEnvironment<T>(IResourceBuilder<T>, Action<EnvironmentCallbackContext>)

Allows for the population of environment variables on a resource.

WithEnvironment<T>(IResourceBuilder<T>, Func<EnvironmentCallbackContext,Task>)

Allows for the population of environment variables on a resource.

WithEnvironment<T>(IResourceBuilder<T>, String, EndpointReference)

Adds an environment variable to the resource with the endpoint for endpointReference.

WithEnvironment<T>(IResourceBuilder<T>, String, IResourceBuilder<IResourceWithConnectionString>)

Adds an environment variable to the resource with the connection string from the referenced resource.

WithEnvironment<T>(IResourceBuilder<T>, String, IResourceBuilder<ParameterResource>)

Adds an environment variable to the resource with the value from parameter.

WithEnvironment<T>(IResourceBuilder<T>, String, ReferenceExpression+ExpressionInterpolatedStringHandler)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, ReferenceExpression)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, Func<String>)

Adds an environment variable to the resource.

WithEnvironment<T>(IResourceBuilder<T>, String, String)

Adds an environment variable to the resource.

WithExternalHttpEndpoints<T>(IResourceBuilder<T>)

Marks existing http or https endpoints on a resource as external.

WithHttpEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, Boolean)

Exposes an HTTP endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be "http" if not specified.

WithHttpsEndpoint<T>(IResourceBuilder<T>, Nullable<Int32>, Nullable<Int32>, String, String, Boolean)

Exposes an HTTPS endpoint on a resource. This endpoint reference can be retrieved using GetEndpoint<T>(IResourceBuilder<T>, String). The endpoint name will be "https" if not specified.

WithManifestPublishingCallback<T>(IResourceBuilder<T>, Action<ManifestPublishingContext>)

Registers a callback which is invoked when manifest is generated for the app model.

WithManifestPublishingCallback<T>(IResourceBuilder<T>, Func<ManifestPublishingContext,Task>)

Registers an async callback which is invoked when manifest is generated for the app model.

WithReference<TDestination>(IResourceBuilder<TDestination>, EndpointReference)

Injects service discovery information from the specified endpoint into the project resource using the source resource's name as the service name. Each endpoint will be injected using the format "services__{sourceResourceName}{endpointName}{endpointIndex}={uriString}."

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithConnectionString>, String, Boolean)

Injects a connection string as an environment variable from the source resource into the destination resource, using the source resource's name as the connection string name (if not overridden). The format of the environment variable will be "ConnectionStrings__{sourceResourceName}={connectionString}."

Each resource defines the format of the connection string value. The underlying connection string value can be retrieved using GetConnectionStringAsync(CancellationToken).

Connection strings are also resolved by the configuration system (appSettings.json in the AppHost project, or environment variables). If a connection string is not found on the resource, the configuration system will be queried for a connection string using the resource's name.

WithReference<TDestination>(IResourceBuilder<TDestination>, IResourceBuilder<IResourceWithServiceDiscovery>)

Injects service discovery information as environment variables from the project resource into the destination resource, using the source resource's name as the service name. Each endpoint defined on the project resource will be injected using the format "services__{sourceResourceName}{endpointName}{endpointIndex}={uriString}."

WithReference<TDestination>(IResourceBuilder<TDestination>, String, Uri)

Injects service discovery information as environment variables from the uri into the destination resource, using the name as the service name. The uri will be injected using the format "services__{name}__default__0={uri}."

WithReference<TDestination>(IResourceBuilder<TDestination>, IAWSSDKConfig)

Add a reference to an AWS SDK configuration to the resource.

Applies to