All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.cloudflare.kotlin.WorkersRouteArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.WorkersRouteArgs.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.jvm.JvmName

/**
 * Provides a Cloudflare worker route resource. A route will also require a `cloudflare.WorkerScript`.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const myScript = new cloudflare.WorkersScript("my_script", {});
 * // Runs the specified worker script for all URLs that match `example.com/*`
 * const myRoute = new cloudflare.WorkersRoute("my_route", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     pattern: "example.com/*",
 *     scriptName: myScript.name,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * my_script = cloudflare.WorkersScript("my_script")
 * # Runs the specified worker script for all URLs that match `example.com/*`
 * my_route = cloudflare.WorkersRoute("my_route",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     pattern="example.com/*",
 *     script_name=my_script.name)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myScript = new Cloudflare.WorkersScript("my_script");
 *     // Runs the specified worker script for all URLs that match `example.com/*`
 *     var myRoute = new Cloudflare.WorkersRoute("my_route", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Pattern = "example.com/*",
 *         ScriptName = myScript.Name,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		myScript, err := cloudflare.NewWorkersScript(ctx, "my_script", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Runs the specified worker script for all URLs that match `example.com/*`
 * 		_, err = cloudflare.NewWorkersRoute(ctx, "my_route", &cloudflare.WorkersRouteArgs{
 * 			ZoneId:     pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Pattern:    pulumi.String("example.com/*"),
 * 			ScriptName: myScript.Name,
 * 		})
 * 		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.WorkersRoute;
 * import com.pulumi.cloudflare.WorkersRouteArgs;
 * 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 myScript = new WorkersScript("myScript");
 *         // Runs the specified worker script for all URLs that match `example.com/*`
 *         var myRoute = new WorkersRoute("myRoute", WorkersRouteArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .pattern("example.com/*")
 *             .scriptName(myScript.name())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Runs the specified worker script for all URLs that match `example.com/*`
 *   myRoute:
 *     type: cloudflare:WorkersRoute
 *     name: my_route
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       pattern: example.com/*
 *       scriptName: ${myScript.name}
 *   myScript:
 *     type: cloudflare:WorkersScript
 *     name: my_script
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/workersRoute:WorkersRoute example /
 * ```
 * @property pattern The [route pattern](https://developers.cloudflare.com/workers/about/routes/) to associate the Worker with.
 * @property scriptName Worker script name to invoke for requests that match the route pattern.
 * @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
 * */*/*/*/*/*/*/*/*/*/*/*/
 */
public data class WorkersRouteArgs(
    public val pattern: Output? = null,
    public val scriptName: Output? = null,
    public val zoneId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.cloudflare.WorkersRouteArgs =
        com.pulumi.cloudflare.WorkersRouteArgs.builder()
            .pattern(pattern?.applyValue({ args0 -> args0 }))
            .scriptName(scriptName?.applyValue({ args0 -> args0 }))
            .zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [WorkersRouteArgs].
 */
@PulumiTagMarker
public class WorkersRouteArgsBuilder internal constructor() {
    private var pattern: Output? = null

    private var scriptName: Output? = null

    private var zoneId: Output? = null

    /**
     * @param value The [route pattern](https://developers.cloudflare.com/workers/about/routes/) to associate the Worker with.
     */
    @JvmName("aalctgrcsumascmi")
    public suspend fun pattern(`value`: Output) {
        this.pattern = value
    }

    /**
     * @param value Worker script name to invoke for requests that match the route pattern.
     */
    @JvmName("chdtsabjhgkrbowm")
    public suspend fun scriptName(`value`: Output) {
        this.scriptName = value
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("isvnffrgpdjorhgs")
    public suspend fun zoneId(`value`: Output) {
        this.zoneId = value
    }

    /**
     * @param value The [route pattern](https://developers.cloudflare.com/workers/about/routes/) to associate the Worker with.
     */
    @JvmName("hbiccyfcjesuxajb")
    public suspend fun pattern(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.pattern = mapped
    }

    /**
     * @param value Worker script name to invoke for requests that match the route pattern.
     */
    @JvmName("vbpathehbjiwkjpn")
    public suspend fun scriptName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.scriptName = mapped
    }

    /**
     * @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    @JvmName("wbqclshuuhxscrbu")
    public suspend fun zoneId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zoneId = mapped
    }

    internal fun build(): WorkersRouteArgs = WorkersRouteArgs(
        pattern = pattern,
        scriptName = scriptName,
        zoneId = zoneId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy