com.pulumi.cloudflare.kotlin.WorkerScriptArgs.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.WorkerScriptArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptAnalyticsEngineBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptAnalyticsEngineBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptD1DatabaseBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptD1DatabaseBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptHyperdriveConfigBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptHyperdriveConfigBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptKvNamespaceBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptKvNamespaceBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptPlacementArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptPlacementArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptPlainTextBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptPlainTextBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptQueueBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptQueueBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptR2BucketBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptR2BucketBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptSecretTextBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptSecretTextBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptServiceBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptServiceBindingArgsBuilder
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptWebassemblyBindingArgs
import com.pulumi.cloudflare.kotlin.inputs.WorkerScriptWebassemblyBindingArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* 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.WorkerScript("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.WorkerScript("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.WorkerScript("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.WorkerScriptKvNamespaceBindingArgs
* {
* Name = "MY_EXAMPLE_KV_NAMESPACE",
* NamespaceId = myNamespace.Id,
* },
* },
* PlainTextBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptPlainTextBindingArgs
* {
* Name = "MY_EXAMPLE_PLAIN_TEXT",
* Text = "foobar",
* },
* },
* SecretTextBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptSecretTextBindingArgs
* {
* Name = "MY_EXAMPLE_SECRET_TEXT",
* Text = secretFooValue,
* },
* },
* WebassemblyBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptWebassemblyBindingArgs
* {
* Name = "MY_EXAMPLE_WASM",
* Module = Std.Filebase64.Invoke(new()
* {
* Input = "example.wasm",
* }).Apply(invoke => invoke.Result),
* },
* },
* ServiceBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptServiceBindingArgs
* {
* Name = "MY_SERVICE_BINDING",
* Service = "MY_SERVICE",
* Environment = "production",
* },
* },
* R2BucketBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptR2BucketBindingArgs
* {
* Name = "MY_BUCKET",
* BucketName = "MY_BUCKET_NAME",
* },
* },
* AnalyticsEngineBindings = new[]
* {
* new Cloudflare.Inputs.WorkerScriptAnalyticsEngineBindingArgs
* {
* 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.NewWorkerScript(ctx, "my_script", &cloudflare.WorkerScriptArgs{
* AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
* Name: pulumi.String("script_1"),
* Content: pulumi.String(invokeFile.Result),
* KvNamespaceBindings: cloudflare.WorkerScriptKvNamespaceBindingArray{
* &cloudflare.WorkerScriptKvNamespaceBindingArgs{
* Name: pulumi.String("MY_EXAMPLE_KV_NAMESPACE"),
* NamespaceId: myNamespace.ID(),
* },
* },
* PlainTextBindings: cloudflare.WorkerScriptPlainTextBindingArray{
* &cloudflare.WorkerScriptPlainTextBindingArgs{
* Name: pulumi.String("MY_EXAMPLE_PLAIN_TEXT"),
* Text: pulumi.String("foobar"),
* },
* },
* SecretTextBindings: cloudflare.WorkerScriptSecretTextBindingArray{
* &cloudflare.WorkerScriptSecretTextBindingArgs{
* Name: pulumi.String("MY_EXAMPLE_SECRET_TEXT"),
* Text: pulumi.Any(secretFooValue),
* },
* },
* WebassemblyBindings: cloudflare.WorkerScriptWebassemblyBindingArray{
* &cloudflare.WorkerScriptWebassemblyBindingArgs{
* Name: pulumi.String("MY_EXAMPLE_WASM"),
* Module: pulumi.String(invokeFilebase641.Result),
* },
* },
* ServiceBindings: cloudflare.WorkerScriptServiceBindingArray{
* &cloudflare.WorkerScriptServiceBindingArgs{
* Name: pulumi.String("MY_SERVICE_BINDING"),
* Service: pulumi.String("MY_SERVICE"),
* Environment: pulumi.String("production"),
* },
* },
* R2BucketBindings: cloudflare.WorkerScriptR2BucketBindingArray{
* &cloudflare.WorkerScriptR2BucketBindingArgs{
* Name: pulumi.String("MY_BUCKET"),
* BucketName: pulumi.String("MY_BUCKET_NAME"),
* },
* },
* AnalyticsEngineBindings: cloudflare.WorkerScriptAnalyticsEngineBindingArray{
* &cloudflare.WorkerScriptAnalyticsEngineBindingArgs{
* 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.WorkerScript;
* import com.pulumi.cloudflare.WorkerScriptArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptKvNamespaceBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptPlainTextBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptSecretTextBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptWebassemblyBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptServiceBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptR2BucketBindingArgs;
* import com.pulumi.cloudflare.inputs.WorkerScriptAnalyticsEngineBindingArgs;
* 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 WorkerScript("myScript", WorkerScriptArgs.builder()
* .accountId("f037e56e89293a057740de681ac9abbe")
* .name("script_1")
* .content(StdFunctions.file(FileArgs.builder()
* .input("script.js")
* .build()).result())
* .kvNamespaceBindings(WorkerScriptKvNamespaceBindingArgs.builder()
* .name("MY_EXAMPLE_KV_NAMESPACE")
* .namespaceId(myNamespace.id())
* .build())
* .plainTextBindings(WorkerScriptPlainTextBindingArgs.builder()
* .name("MY_EXAMPLE_PLAIN_TEXT")
* .text("foobar")
* .build())
* .secretTextBindings(WorkerScriptSecretTextBindingArgs.builder()
* .name("MY_EXAMPLE_SECRET_TEXT")
* .text(secretFooValue)
* .build())
* .webassemblyBindings(WorkerScriptWebassemblyBindingArgs.builder()
* .name("MY_EXAMPLE_WASM")
* .module(StdFunctions.filebase64(Filebase64Args.builder()
* .input("example.wasm")
* .build()).result())
* .build())
* .serviceBindings(WorkerScriptServiceBindingArgs.builder()
* .name("MY_SERVICE_BINDING")
* .service("MY_SERVICE")
* .environment("production")
* .build())
* .r2BucketBindings(WorkerScriptR2BucketBindingArgs.builder()
* .name("MY_BUCKET")
* .bucketName("MY_BUCKET_NAME")
* .build())
* .analyticsEngineBindings(WorkerScriptAnalyticsEngineBindingArgs.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:WorkerScript
* 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/workerScript:WorkerScript example /
* ```
* @property accountId The account identifier to target for the resource.
* @property analyticsEngineBindings
* @property compatibilityDate The date to use for the compatibility flag.
* @property compatibilityFlags Compatibility flags used for Worker Scripts.
* @property content The script content.
* @property d1DatabaseBindings
* @property dispatchNamespace Name of the Workers for Platforms dispatch namespace.
* @property hyperdriveConfigBindings
* @property kvNamespaceBindings
* @property logpush Enabling allows Worker events to be sent to a defined Logpush destination.
* @property module Whether to upload Worker as a module.
* @property name The name for the script. **Modifying this attribute will force creation of a new resource.**
* @property placements
* @property plainTextBindings
* @property queueBindings
* @property r2BucketBindings
* @property secretTextBindings
* @property serviceBindings
* @property tags
* @property webassemblyBindings
*/
public data class WorkerScriptArgs(
public val accountId: Output? = null,
public val analyticsEngineBindings: Output>? = null,
public val compatibilityDate: Output? = null,
public val compatibilityFlags: Output>? = null,
public val content: Output? = null,
public val d1DatabaseBindings: Output>? = null,
public val dispatchNamespace: Output? = null,
public val hyperdriveConfigBindings: Output>? =
null,
public val kvNamespaceBindings: Output>? = null,
public val logpush: Output? = null,
public val module: Output? = null,
public val name: Output? = null,
public val placements: Output>? = null,
public val plainTextBindings: Output>? = null,
public val queueBindings: Output>? = null,
public val r2BucketBindings: Output>? = null,
public val secretTextBindings: Output>? = null,
public val serviceBindings: Output>? = null,
public val tags: Output>? = null,
public val webassemblyBindings: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.cloudflare.WorkerScriptArgs =
com.pulumi.cloudflare.WorkerScriptArgs.builder()
.accountId(accountId?.applyValue({ args0 -> args0 }))
.analyticsEngineBindings(
analyticsEngineBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.compatibilityDate(compatibilityDate?.applyValue({ args0 -> args0 }))
.compatibilityFlags(compatibilityFlags?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.content(content?.applyValue({ args0 -> args0 }))
.d1DatabaseBindings(
d1DatabaseBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.dispatchNamespace(dispatchNamespace?.applyValue({ args0 -> args0 }))
.hyperdriveConfigBindings(
hyperdriveConfigBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.kvNamespaceBindings(
kvNamespaceBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.logpush(logpush?.applyValue({ args0 -> args0 }))
.module(module?.applyValue({ args0 -> args0 }))
.name(name?.applyValue({ args0 -> args0 }))
.placements(
placements?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.plainTextBindings(
plainTextBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.queueBindings(
queueBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.r2BucketBindings(
r2BucketBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.secretTextBindings(
secretTextBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.serviceBindings(
serviceBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
.webassemblyBindings(
webassemblyBindings?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
).build()
}
/**
* Builder for [WorkerScriptArgs].
*/
@PulumiTagMarker
public class WorkerScriptArgsBuilder internal constructor() {
private var accountId: Output? = null
private var analyticsEngineBindings: Output>? = null
private var compatibilityDate: Output? = null
private var compatibilityFlags: Output>? = null
private var content: Output? = null
private var d1DatabaseBindings: Output>? = null
private var dispatchNamespace: Output? = null
private var hyperdriveConfigBindings: Output>? =
null
private var kvNamespaceBindings: Output>? = null
private var logpush: Output? = null
private var module: Output? = null
private var name: Output? = null
private var placements: Output>? = null
private var plainTextBindings: Output>? = null
private var queueBindings: Output>? = null
private var r2BucketBindings: Output>? = null
private var secretTextBindings: Output>? = null
private var serviceBindings: Output>? = null
private var tags: Output>? = null
private var webassemblyBindings: Output>? = null
/**
* @param value The account identifier to target for the resource.
*/
@JvmName("wldcvsnxnisoewwi")
public suspend fun accountId(`value`: Output) {
this.accountId = value
}
/**
* @param value
*/
@JvmName("tnohtgtuyxtutqse")
public suspend fun analyticsEngineBindings(`value`: Output>) {
this.analyticsEngineBindings = value
}
@JvmName("gauejunaxrnfigjb")
public suspend fun analyticsEngineBindings(vararg values: Output) {
this.analyticsEngineBindings = Output.all(values.asList())
}
/**
* @param values
*/
@JvmName("lqofrjobmehoapya")
public suspend fun analyticsEngineBindings(values: List