WorkerCronTriggerArgs

data class WorkerCronTriggerArgs(val accountId: Output<String>? = null, val schedules: Output<List<String>>? = null, val scriptName: Output<String>? = null) : ConvertibleToJava<WorkerCronTriggerArgs>

/* Worker Cron Triggers allow users to map a cron expression to a Worker script using a ScheduledEvent listener that enables Workers to be executed on a schedule. Worker Cron Triggers are ideal for running periodic jobs for maintenance or calling third-party APIs to collect up-to-date data.

This resource uses the Cloudflare account APIs. This requires setting the CLOUDFLARE_ACCOUNT_ID environment variable or account_id provider argument if you do not explicitly set the resource level account_id value.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.WorkerScript;
import com.pulumi.cloudflare.WorkerScriptArgs;
import com.pulumi.cloudflare.WorkerCronTrigger;
import com.pulumi.cloudflare.WorkerCronTriggerArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleScript = new WorkerScript("exampleScript", WorkerScriptArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.name("example-script")
.content(Files.readString(Paths.get("path/to/my.js")))
.build());
var exampleTrigger = new WorkerCronTrigger("exampleTrigger", WorkerCronTriggerArgs.builder()
.accountId("f037e56e89293a057740de681ac9abbe")
.scriptName(exampleScript.name())
.schedules(
"*/5 * * * *",
"10 7 * * mon-fri")
.build());
}
}

Import

$ pulumi import cloudflare:index/workerCronTrigger:WorkerCronTrigger example <account_id>/<script_name>

Constructors

Link copied to clipboard
constructor(accountId: Output<String>? = null, schedules: Output<List<String>>? = null, scriptName: Output<String>? = null)

Properties

Link copied to clipboard
val accountId: Output<String>? = null

The account identifier to target for the resource.

Link copied to clipboard
val schedules: Output<List<String>>? = null

Cron expressions to execute the Worker script.

Link copied to clipboard
val scriptName: Output<String>? = null

Worker script to target for the schedules.

Functions

Link copied to clipboard
open override fun toJava(): WorkerCronTriggerArgs