com.pulumi.cloudflare.kotlin.WorkersCronTriggerArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-cloudflare-kotlin Show documentation
Show all versions of pulumi-cloudflare-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.WorkersCronTriggerArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* /* /* /* /* /* /*
* 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.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as cloudflare from "@pulumi/cloudflare";
* import * as std from "@pulumi/std";
* const exampleScript = new cloudflare.WorkersScript("example_script", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* name: "example-script",
* content: std.file({
* input: "path/to/my.js",
* }).then(invoke => invoke.result),
* });
* const exampleTrigger = new cloudflare.WorkersCronTrigger("example_trigger", {
* accountId: "f037e56e89293a057740de681ac9abbe",
* scriptName: exampleScript.name,
* schedules: [
* "*/5 * * * *",
* "10 7 * * mon-fri",
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_cloudflare as cloudflare
* import pulumi_std as std
* example_script = cloudflare.WorkersScript("example_script",
* account_id="f037e56e89293a057740de681ac9abbe",
* name="example-script",
* content=std.file(input="path/to/my.js").result)
* example_trigger = cloudflare.WorkersCronTrigger("example_trigger",
* account_id="f037e56e89293a057740de681ac9abbe",
* script_name=example_script.name,
* schedules=[
* "*/5 * * * *",
* "10 7 * * mon-fri",
* ])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Cloudflare = Pulumi.Cloudflare;
* using Std = Pulumi.Std;
* return await Deployment.RunAsync(() =>
* {
* var exampleScript = new Cloudflare.WorkersScript("example_script", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* Name = "example-script",
* Content = Std.File.Invoke(new()
* {
* Input = "path/to/my.js",
* }).Apply(invoke => invoke.Result),
* });
* var exampleTrigger = new Cloudflare.WorkersCronTrigger("example_trigger", new()
* {
* AccountId = "f037e56e89293a057740de681ac9abbe",
* ScriptName = exampleScript.Name,
* Schedules = new[]
* {
* "*/5 * * * *",
* "10 7 * * mon-fri",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
* "github.com/pulumi/pulumi-std/sdk/go/std"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* invokeFile, err := std.File(ctx, &std.FileArgs{
* Input: "path/to/my.js",
* }, nil)
* if err != nil {
* return err
* }
* exampleScript, err := cloudflare.NewWorkersScript(ctx, "example_script", &cloudflare.WorkersScriptArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("example-script"),
* Content: pulumi.String(invokeFile.Result),
* })
* if err != nil {
* return err
* }
* _, err = cloudflare.NewWorkersCronTrigger(ctx, "example_trigger", &cloudflare.WorkersCronTriggerArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* ScriptName: exampleScript.Name,
* Schedules: pulumi.StringArray{
* pulumi.String("*/5 * * * *"),
* pulumi.String("10 7 * * mon-fri"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.cloudflare.WorkersScript;
* import com.pulumi.cloudflare.WorkersScriptArgs;
* import com.pulumi.cloudflare.WorkersCronTrigger;
* import com.pulumi.cloudflare.WorkersCronTriggerArgs;
* 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 WorkersScript("exampleScript", WorkersScriptArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("example-script")
* .content(StdFunctions.file(FileArgs.builder()
* .input("path/to/my.js")
* .build()).result())
* .build());
* var exampleTrigger = new WorkersCronTrigger("exampleTrigger", WorkersCronTriggerArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .scriptName(exampleScript.name())
* .schedules(
* "*/5 * * * *",
* "10 7 * * mon-fri")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* exampleScript:
* type: cloudflare:WorkersScript
* name: example_script
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* name: example-script
* content:
* fn::invoke:
* Function: std:file
* Arguments:
* input: path/to/my.js
* Return: result
* exampleTrigger:
* type: cloudflare:WorkersCronTrigger
* name: example_trigger
* properties:
* accountId: f037e56e89293a057740de681ac9abbe
* scriptName: ${exampleScript.name}
* schedules:
* - '*/5 * * * *'
* - 10 7 * * mon-fri
* ```
*
* ## Import
* ```sh
* $ pulumi import cloudflare:index/workersCronTrigger:WorkersCronTrigger example /
* ```
* @property accountId The account identifier to target for the resource.
* @property schedules Cron expressions to execute the Worker script.
* @property scriptName Worker script to target for the schedules.
*/
public data class WorkersCronTriggerArgs(
public val accountId: Output? = null,
public val schedules: Output>? = null,
public val scriptName: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.cloudflare.WorkersCronTriggerArgs =
com.pulumi.cloudflare.WorkersCronTriggerArgs.builder()
.accountId(accountId?.applyValue({ args0 -> args0 }))
.schedules(schedules?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.scriptName(scriptName?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [WorkersCronTriggerArgs].
*/
@PulumiTagMarker
public class WorkersCronTriggerArgsBuilder internal constructor() {
private var accountId: Output? = null
private var schedules: Output>? = null
private var scriptName: Output? = null
/**
* @param value The account identifier to target for the resource.
*/
@JvmName("bcwmujrvbqberabv")
public suspend fun accountId(`value`: Output) {
this.accountId = value
}
/**
* @param value Cron expressions to execute the Worker script.
*/
@JvmName("irkhjhaovkuugfgt")
public suspend fun schedules(`value`: Output>) {
this.schedules = value
}
@JvmName("axivjfhvjrilhawl")
public suspend fun schedules(vararg values: Output) {
this.schedules = Output.all(values.asList())
}
/**
* @param values Cron expressions to execute the Worker script.
*/
@JvmName("kdbishkifcptlanw")
public suspend fun schedules(values: List