import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; /** * Provides a Cloudflare worker script resource. In order for a script to be active, you'll also need to setup a `cloudflare.WorkerRoute`. *NOTE:* This resource uses the Cloudflare account APIs. This requires setting the `CLOUDFLARE_ACCOUNT_ID` environment variable or `accountId` provider argument. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi_cloudflare from "@mapped/pulumi-cloudflare"; * import * from "fs"; * * const myNamespace = new cloudflare.WorkersKvNamespace("myNamespace", {title: "example"}); * // Sets the script with the name "script_1" * const myScript = new cloudflare.WorkerScript("myScript", { * name: "script_1", * content: fs.readFileSync("script.js"), * kvNamespaceBindings: [{ * name: "MY_EXAMPLE_KV_NAMESPACE", * namespaceId: myNamespace.id, * }], * plainTextBindings: [{ * name: "MY_EXAMPLE_PLAIN_TEXT", * text: "foobar", * }], * secretTextBindings: [{ * name: "MY_EXAMPLE_SECRET_TEXT", * text: _var.secret_foo_value, * }], * webassemblyBindings: [{ * name: "MY_EXAMPLE_WASM", * module: Buffer.from(fs.readFileSync("example.wasm"), 'binary').toString('base64'), * }], * }); * ``` * * ## Import * * To import a script, use a script name, e.g. `script_name` * * ```sh * $ pulumi import cloudflare:index/workerScript:WorkerScript default script_name * ``` * * where* `script_name` - the script name */ export declare class WorkerScript extends pulumi.CustomResource { /** * Get an existing WorkerScript resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: WorkerScriptState, opts?: pulumi.CustomResourceOptions): WorkerScript; /** * Returns true if the given object is an instance of WorkerScript. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is WorkerScript; /** * The script content. */ readonly content: pulumi.Output; readonly kvNamespaceBindings: pulumi.Output; /** * The global variable for the binding in your Worker code. */ readonly name: pulumi.Output; readonly plainTextBindings: pulumi.Output; readonly secretTextBindings: pulumi.Output; readonly webassemblyBindings: pulumi.Output; /** * Create a WorkerScript resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: WorkerScriptArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering WorkerScript resources. */ export interface WorkerScriptState { /** * The script content. */ content?: pulumi.Input; kvNamespaceBindings?: pulumi.Input[]>; /** * The global variable for the binding in your Worker code. */ name?: pulumi.Input; plainTextBindings?: pulumi.Input[]>; secretTextBindings?: pulumi.Input[]>; webassemblyBindings?: pulumi.Input[]>; } /** * The set of arguments for constructing a WorkerScript resource. */ export interface WorkerScriptArgs { /** * The script content. */ content: pulumi.Input; kvNamespaceBindings?: pulumi.Input[]>; /** * The global variable for the binding in your Worker code. */ name: pulumi.Input; plainTextBindings?: pulumi.Input[]>; secretTextBindings?: pulumi.Input[]>; webassemblyBindings?: pulumi.Input[]>; }