Dela via


ContainerAppExtensions.PublishAsScheduledAzureContainerAppJob<T> Method

Definition

Configures the specified compute resource as a scheduled Azure Container App Job with the provided cron expression.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> PublishAsScheduledAzureContainerAppJob<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> resource, string cronExpression, Action<Aspire.Hosting.Azure.AzureResourceInfrastructure,Azure.Provisioning.AppContainers.ContainerAppJob>? configure = default) where T : Aspire.Hosting.ApplicationModel.IComputeResource;
static member PublishAsScheduledAzureContainerAppJob : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> * string * Action<Aspire.Hosting.Azure.AzureResourceInfrastructure, Azure.Provisioning.AppContainers.ContainerAppJob> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)
<Extension()>
Public Function PublishAsScheduledAzureContainerAppJob(Of T As IComputeResource) (resource As IResourceBuilder(Of T), cronExpression As String, Optional configure As Action(Of AzureResourceInfrastructure, ContainerAppJob) = Nothing) As IResourceBuilder(Of T)

Type Parameters

T

The type of the compute resource.

Parameters

resource
IResourceBuilder<T>

The compute resource builder.

cronExpression
String

The cron expression that defines the schedule for the job.

configure
Action<AzureResourceInfrastructure,ContainerAppJob>

The configuration action for the container app job.

Returns

The updated compute resource builder.

Remarks

This method is a convenience wrapper around PublishAsAzureContainerAppJob<T>(IResourceBuilder<T>, Action<AzureResourceInfrastructure,ContainerAppJob>) that automatically configures the job with a schedule trigger using the specified cron expression.

builder.AddProject<Projects.ProcessorJob>("job")
       .PublishAsScheduledAzureContainerAppJob("0 0 * * *"); // Run every day at midnight

Applies to