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

com.pulumi.cloudflare.kotlin.WorkersScript.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.kotlin.outputs.WorkersScriptAnalyticsEngineBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptD1DatabaseBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptKvNamespaceBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptPlacement
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptPlainTextBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptQueueBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptR2BucketBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptSecretTextBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptServiceBinding
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptWebassemblyBinding
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptAnalyticsEngineBinding.Companion.toKotlin as workersScriptAnalyticsEngineBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptD1DatabaseBinding.Companion.toKotlin as workersScriptD1DatabaseBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptKvNamespaceBinding.Companion.toKotlin as workersScriptKvNamespaceBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptPlacement.Companion.toKotlin as workersScriptPlacementToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptPlainTextBinding.Companion.toKotlin as workersScriptPlainTextBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptQueueBinding.Companion.toKotlin as workersScriptQueueBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptR2BucketBinding.Companion.toKotlin as workersScriptR2BucketBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptSecretTextBinding.Companion.toKotlin as workersScriptSecretTextBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptServiceBinding.Companion.toKotlin as workersScriptServiceBindingToKotlin
import com.pulumi.cloudflare.kotlin.outputs.WorkersScriptWebassemblyBinding.Companion.toKotlin as workersScriptWebassemblyBindingToKotlin

/**
 * Builder for [WorkersScript].
 */
@PulumiTagMarker
public class WorkersScriptResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: WorkersScriptArgs = WorkersScriptArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend WorkersScriptArgsBuilder.() -> Unit) {
        val builder = WorkersScriptArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): WorkersScript {
        val builtJavaResource = com.pulumi.cloudflare.WorkersScript(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return WorkersScript(builtJavaResource)
    }
}

/**
 * Provides a Cloudflare worker script resource. In order for a script to be active, you'll also need to setup a `cloudflare.WorkerRoute`.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * import * as std from "@pulumi/std";
 * const myNamespace = new cloudflare.WorkersKvNamespace("my_namespace", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     title: "example",
 * });
 * // Sets the script with the name "script_1"
 * const myScript = new cloudflare.WorkersScript("my_script", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     name: "script_1",
 *     content: std.file({
 *         input: "script.js",
 *     }).then(invoke => invoke.result),
 *     kvNamespaceBindings: [{
 *         name: "MY_EXAMPLE_KV_NAMESPACE",
 *         namespaceId: myNamespace.id,
 *     }],
 *     plainTextBindings: [{
 *         name: "MY_EXAMPLE_PLAIN_TEXT",
 *         text: "foobar",
 *     }],
 *     secretTextBindings: [{
 *         name: "MY_EXAMPLE_SECRET_TEXT",
 *         text: secretFooValue,
 *     }],
 *     webassemblyBindings: [{
 *         name: "MY_EXAMPLE_WASM",
 *         module: std.filebase64({
 *             input: "example.wasm",
 *         }).then(invoke => invoke.result),
 *     }],
 *     serviceBindings: [{
 *         name: "MY_SERVICE_BINDING",
 *         service: "MY_SERVICE",
 *         environment: "production",
 *     }],
 *     r2BucketBindings: [{
 *         name: "MY_BUCKET",
 *         bucketName: "MY_BUCKET_NAME",
 *     }],
 *     analyticsEngineBindings: [{
 *         name: "MY_DATASET",
 *         dataset: "dataset1",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * import pulumi_std as std
 * my_namespace = cloudflare.WorkersKvNamespace("my_namespace",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     title="example")
 * # Sets the script with the name "script_1"
 * my_script = cloudflare.WorkersScript("my_script",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="script_1",
 *     content=std.file(input="script.js").result,
 *     kv_namespace_bindings=[{
 *         "name": "MY_EXAMPLE_KV_NAMESPACE",
 *         "namespace_id": my_namespace.id,
 *     }],
 *     plain_text_bindings=[{
 *         "name": "MY_EXAMPLE_PLAIN_TEXT",
 *         "text": "foobar",
 *     }],
 *     secret_text_bindings=[{
 *         "name": "MY_EXAMPLE_SECRET_TEXT",
 *         "text": secret_foo_value,
 *     }],
 *     webassembly_bindings=[{
 *         "name": "MY_EXAMPLE_WASM",
 *         "module": std.filebase64(input="example.wasm").result,
 *     }],
 *     service_bindings=[{
 *         "name": "MY_SERVICE_BINDING",
 *         "service": "MY_SERVICE",
 *         "environment": "production",
 *     }],
 *     r2_bucket_bindings=[{
 *         "name": "MY_BUCKET",
 *         "bucket_name": "MY_BUCKET_NAME",
 *     }],
 *     analytics_engine_bindings=[{
 *         "name": "MY_DATASET",
 *         "dataset": "dataset1",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var myNamespace = new Cloudflare.WorkersKvNamespace("my_namespace", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Title = "example",
 *     });
 *     // Sets the script with the name "script_1"
 *     var myScript = new Cloudflare.WorkersScript("my_script", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Name = "script_1",
 *         Content = Std.File.Invoke(new()
 *         {
 *             Input = "script.js",
 *         }).Apply(invoke => invoke.Result),
 *         KvNamespaceBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptKvNamespaceBindingArgs
 *             {
 *                 Name = "MY_EXAMPLE_KV_NAMESPACE",
 *                 NamespaceId = myNamespace.Id,
 *             },
 *         },
 *         PlainTextBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptPlainTextBindingArgs
 *             {
 *                 Name = "MY_EXAMPLE_PLAIN_TEXT",
 *                 Text = "foobar",
 *             },
 *         },
 *         SecretTextBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptSecretTextBindingArgs
 *             {
 *                 Name = "MY_EXAMPLE_SECRET_TEXT",
 *                 Text = secretFooValue,
 *             },
 *         },
 *         WebassemblyBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptWebassemblyBindingArgs
 *             {
 *                 Name = "MY_EXAMPLE_WASM",
 *                 Module = Std.Filebase64.Invoke(new()
 *                 {
 *                     Input = "example.wasm",
 *                 }).Apply(invoke => invoke.Result),
 *             },
 *         },
 *         ServiceBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptServiceBindingArgs
 *             {
 *                 Name = "MY_SERVICE_BINDING",
 *                 Service = "MY_SERVICE",
 *                 Environment = "production",
 *             },
 *         },
 *         R2BucketBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptR2BucketBindingArgs
 *             {
 *                 Name = "MY_BUCKET",
 *                 BucketName = "MY_BUCKET_NAME",
 *             },
 *         },
 *         AnalyticsEngineBindings = new[]
 *         {
 *             new Cloudflare.Inputs.WorkersScriptAnalyticsEngineBindingArgs
 *             {
 *                 Name = "MY_DATASET",
 *                 Dataset = "dataset1",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		myNamespace, err := cloudflare.NewWorkersKvNamespace(ctx, "my_namespace", &cloudflare.WorkersKvNamespaceArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Title:     pulumi.String("example"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFile, err := std.File(ctx, &std.FileArgs{
 * 			Input: "script.js",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		invokeFilebase641, err := std.Filebase64(ctx, &std.Filebase64Args{
 * 			Input: "example.wasm",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		// Sets the script with the name "script_1"
 * 		_, err = cloudflare.NewWorkersScript(ctx, "my_script", &cloudflare.WorkersScriptArgs{
 * 			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Name:      pulumi.String("script_1"),
 * 			Content:   pulumi.String(invokeFile.Result),
 * 			KvNamespaceBindings: cloudflare.WorkersScriptKvNamespaceBindingArray{
 * 				&cloudflare.WorkersScriptKvNamespaceBindingArgs{
 * 					Name:        pulumi.String("MY_EXAMPLE_KV_NAMESPACE"),
 * 					NamespaceId: myNamespace.ID(),
 * 				},
 * 			},
 * 			PlainTextBindings: cloudflare.WorkersScriptPlainTextBindingArray{
 * 				&cloudflare.WorkersScriptPlainTextBindingArgs{
 * 					Name: pulumi.String("MY_EXAMPLE_PLAIN_TEXT"),
 * 					Text: pulumi.String("foobar"),
 * 				},
 * 			},
 * 			SecretTextBindings: cloudflare.WorkersScriptSecretTextBindingArray{
 * 				&cloudflare.WorkersScriptSecretTextBindingArgs{
 * 					Name: pulumi.String("MY_EXAMPLE_SECRET_TEXT"),
 * 					Text: pulumi.Any(secretFooValue),
 * 				},
 * 			},
 * 			WebassemblyBindings: cloudflare.WorkersScriptWebassemblyBindingArray{
 * 				&cloudflare.WorkersScriptWebassemblyBindingArgs{
 * 					Name:   pulumi.String("MY_EXAMPLE_WASM"),
 * 					Module: pulumi.String(invokeFilebase641.Result),
 * 				},
 * 			},
 * 			ServiceBindings: cloudflare.WorkersScriptServiceBindingArray{
 * 				&cloudflare.WorkersScriptServiceBindingArgs{
 * 					Name:        pulumi.String("MY_SERVICE_BINDING"),
 * 					Service:     pulumi.String("MY_SERVICE"),
 * 					Environment: pulumi.String("production"),
 * 				},
 * 			},
 * 			R2BucketBindings: cloudflare.WorkersScriptR2BucketBindingArray{
 * 				&cloudflare.WorkersScriptR2BucketBindingArgs{
 * 					Name:       pulumi.String("MY_BUCKET"),
 * 					BucketName: pulumi.String("MY_BUCKET_NAME"),
 * 				},
 * 			},
 * 			AnalyticsEngineBindings: cloudflare.WorkersScriptAnalyticsEngineBindingArray{
 * 				&cloudflare.WorkersScriptAnalyticsEngineBindingArgs{
 * 					Name:    pulumi.String("MY_DATASET"),
 * 					Dataset: pulumi.String("dataset1"),
 * 				},
 * 			},
 * 		})
 * 		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.WorkersKvNamespace;
 * import com.pulumi.cloudflare.WorkersKvNamespaceArgs;
 * import com.pulumi.cloudflare.WorkersScript;
 * import com.pulumi.cloudflare.WorkersScriptArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptKvNamespaceBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptPlainTextBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptSecretTextBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptWebassemblyBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptServiceBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptR2BucketBindingArgs;
 * import com.pulumi.cloudflare.inputs.WorkersScriptAnalyticsEngineBindingArgs;
 * 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 myNamespace = new WorkersKvNamespace("myNamespace", WorkersKvNamespaceArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .title("example")
 *             .build());
 *         // Sets the script with the name "script_1"
 *         var myScript = new WorkersScript("myScript", WorkersScriptArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .name("script_1")
 *             .content(StdFunctions.file(FileArgs.builder()
 *                 .input("script.js")
 *                 .build()).result())
 *             .kvNamespaceBindings(WorkersScriptKvNamespaceBindingArgs.builder()
 *                 .name("MY_EXAMPLE_KV_NAMESPACE")
 *                 .namespaceId(myNamespace.id())
 *                 .build())
 *             .plainTextBindings(WorkersScriptPlainTextBindingArgs.builder()
 *                 .name("MY_EXAMPLE_PLAIN_TEXT")
 *                 .text("foobar")
 *                 .build())
 *             .secretTextBindings(WorkersScriptSecretTextBindingArgs.builder()
 *                 .name("MY_EXAMPLE_SECRET_TEXT")
 *                 .text(secretFooValue)
 *                 .build())
 *             .webassemblyBindings(WorkersScriptWebassemblyBindingArgs.builder()
 *                 .name("MY_EXAMPLE_WASM")
 *                 .module(StdFunctions.filebase64(Filebase64Args.builder()
 *                     .input("example.wasm")
 *                     .build()).result())
 *                 .build())
 *             .serviceBindings(WorkersScriptServiceBindingArgs.builder()
 *                 .name("MY_SERVICE_BINDING")
 *                 .service("MY_SERVICE")
 *                 .environment("production")
 *                 .build())
 *             .r2BucketBindings(WorkersScriptR2BucketBindingArgs.builder()
 *                 .name("MY_BUCKET")
 *                 .bucketName("MY_BUCKET_NAME")
 *                 .build())
 *             .analyticsEngineBindings(WorkersScriptAnalyticsEngineBindingArgs.builder()
 *                 .name("MY_DATASET")
 *                 .dataset("dataset1")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   myNamespace:
 *     type: cloudflare:WorkersKvNamespace
 *     name: my_namespace
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       title: example
 *   # Sets the script with the name "script_1"
 *   myScript:
 *     type: cloudflare:WorkersScript
 *     name: my_script
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       name: script_1
 *       content:
 *         fn::invoke:
 *           Function: std:file
 *           Arguments:
 *             input: script.js
 *           Return: result
 *       kvNamespaceBindings:
 *         - name: MY_EXAMPLE_KV_NAMESPACE
 *           namespaceId: ${myNamespace.id}
 *       plainTextBindings:
 *         - name: MY_EXAMPLE_PLAIN_TEXT
 *           text: foobar
 *       secretTextBindings:
 *         - name: MY_EXAMPLE_SECRET_TEXT
 *           text: ${secretFooValue}
 *       webassemblyBindings:
 *         - name: MY_EXAMPLE_WASM
 *           module:
 *             fn::invoke:
 *               Function: std:filebase64
 *               Arguments:
 *                 input: example.wasm
 *               Return: result
 *       serviceBindings:
 *         - name: MY_SERVICE_BINDING
 *           service: MY_SERVICE
 *           environment: production
 *       r2BucketBindings:
 *         - name: MY_BUCKET
 *           bucketName: MY_BUCKET_NAME
 *       analyticsEngineBindings:
 *         - name: MY_DATASET
 *           dataset: dataset1
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/workersScript:WorkersScript example /
 * ```
 */
public class WorkersScript internal constructor(
    override val javaResource: com.pulumi.cloudflare.WorkersScript,
) : KotlinCustomResource(javaResource, WorkersScriptMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    public val analyticsEngineBindings: Output>?
        get() = javaResource.analyticsEngineBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptAnalyticsEngineBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The date to use for the compatibility flag.
     */
    public val compatibilityDate: Output?
        get() = javaResource.compatibilityDate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Compatibility flags used for Worker Scripts.
     */
    public val compatibilityFlags: Output>
        get() = javaResource.compatibilityFlags().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The script content.
     */
    public val content: Output
        get() = javaResource.content().applyValue({ args0 -> args0 })

    public val d1DatabaseBindings: Output>?
        get() = javaResource.d1DatabaseBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptD1DatabaseBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Name of the Workers for Platforms dispatch namespace.
     */
    public val dispatchNamespace: Output?
        get() = javaResource.dispatchNamespace().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    public val kvNamespaceBindings: Output>?
        get() = javaResource.kvNamespaceBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptKvNamespaceBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Enabling allows Worker events to be sent to a defined Logpush destination.
     */
    public val logpush: Output?
        get() = javaResource.logpush().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Whether to upload Worker as a module.
     */
    public val module: Output?
        get() = javaResource.module().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The name for the script. **Modifying this attribute will force creation of a new resource.**
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val placements: Output>?
        get() = javaResource.placements().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> workersScriptPlacementToKotlin(args0) })
                })
            }).orElse(null)
        })

    public val plainTextBindings: Output>?
        get() = javaResource.plainTextBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptPlainTextBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val queueBindings: Output>?
        get() = javaResource.queueBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptQueueBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val r2BucketBindings: Output>?
        get() = javaResource.r2BucketBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptR2BucketBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val secretTextBindings: Output>?
        get() = javaResource.secretTextBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptSecretTextBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val serviceBindings: Output>?
        get() = javaResource.serviceBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptServiceBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    public val tags: Output>
        get() = javaResource.tags().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    public val webassemblyBindings: Output>?
        get() = javaResource.webassemblyBindings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        workersScriptWebassemblyBindingToKotlin(args0)
                    })
                })
            }).orElse(null)
        })
}

public object WorkersScriptMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.WorkersScript::class == javaResource::class

    override fun map(javaResource: Resource): WorkersScript = WorkersScript(
        javaResource as
            com.pulumi.cloudflare.WorkersScript,
    )
}

/**
 * @see [WorkersScript].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [WorkersScript].
 */
public suspend fun workersScript(
    name: String,
    block: suspend WorkersScriptResourceBuilder.() -> Unit,
): WorkersScript {
    val builder = WorkersScriptResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [WorkersScript].
 * @param name The _unique_ name of the resulting resource.
 */
public fun workersScript(name: String): WorkersScript {
    val builder = WorkersScriptResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy