1. Packages
  2. Cloudflare Provider
  3. API Docs
  4. WorkersForPlatformsDispatchNamespace
Cloudflare v5.49.1 published on Tuesday, Feb 18, 2025 by Pulumi

cloudflare.WorkersForPlatformsDispatchNamespace

Explore with Pulumi AI

The Workers for Platforms resource allows you to manage Cloudflare Workers for Platforms dispatch namespaces.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
import * as std from "@pulumi/std";

const example = new cloudflare.WorkersForPlatformsDispatchNamespace("example", {
    accountId: "f037e56e89293a057740de681ac9abbe",
    name: "example-namespace",
});
const customerWorker1 = new cloudflare.WorkersScript("customer_worker_1", {
    accountId: "f037e56e89293a057740de681ac9abbe",
    name: "customer-worker-1",
    content: std.file({
        input: "script.js",
    }).then(invoke => invoke.result),
    dispatchNamespace: example.name,
    tags: ["free"],
});
Copy
import pulumi
import pulumi_cloudflare as cloudflare
import pulumi_std as std

example = cloudflare.WorkersForPlatformsDispatchNamespace("example",
    account_id="f037e56e89293a057740de681ac9abbe",
    name="example-namespace")
customer_worker1 = cloudflare.WorkersScript("customer_worker_1",
    account_id="f037e56e89293a057740de681ac9abbe",
    name="customer-worker-1",
    content=std.file(input="script.js").result,
    dispatch_namespace=example.name,
    tags=["free"])
Copy
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 {
		example, err := cloudflare.NewWorkersForPlatformsDispatchNamespace(ctx, "example", &cloudflare.WorkersForPlatformsDispatchNamespaceArgs{
			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
			Name:      pulumi.String("example-namespace"),
		})
		if err != nil {
			return err
		}
		invokeFile, err := std.File(ctx, &std.FileArgs{
			Input: "script.js",
		}, nil)
		if err != nil {
			return err
		}
		_, err = cloudflare.NewWorkersScript(ctx, "customer_worker_1", &cloudflare.WorkersScriptArgs{
			AccountId:         pulumi.String("f037e56e89293a057740de681ac9abbe"),
			Name:              pulumi.String("customer-worker-1"),
			Content:           pulumi.String(invokeFile.Result),
			DispatchNamespace: example.Name,
			Tags: pulumi.StringArray{
				pulumi.String("free"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() => 
{
    var example = new Cloudflare.WorkersForPlatformsDispatchNamespace("example", new()
    {
        AccountId = "f037e56e89293a057740de681ac9abbe",
        Name = "example-namespace",
    });

    var customerWorker1 = new Cloudflare.WorkersScript("customer_worker_1", new()
    {
        AccountId = "f037e56e89293a057740de681ac9abbe",
        Name = "customer-worker-1",
        Content = Std.File.Invoke(new()
        {
            Input = "script.js",
        }).Apply(invoke => invoke.Result),
        DispatchNamespace = example.Name,
        Tags = new[]
        {
            "free",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.WorkersForPlatformsDispatchNamespace;
import com.pulumi.cloudflare.WorkersForPlatformsDispatchNamespaceArgs;
import com.pulumi.cloudflare.WorkersScript;
import com.pulumi.cloudflare.WorkersScriptArgs;
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 example = new WorkersForPlatformsDispatchNamespace("example", WorkersForPlatformsDispatchNamespaceArgs.builder()
            .accountId("f037e56e89293a057740de681ac9abbe")
            .name("example-namespace")
            .build());

        var customerWorker1 = new WorkersScript("customerWorker1", WorkersScriptArgs.builder()
            .accountId("f037e56e89293a057740de681ac9abbe")
            .name("customer-worker-1")
            .content(StdFunctions.file(FileArgs.builder()
                .input("script.js")
                .build()).result())
            .dispatchNamespace(example.name())
            .tags("free")
            .build());

    }
}
Copy
resources:
  example:
    type: cloudflare:WorkersForPlatformsDispatchNamespace
    properties:
      accountId: f037e56e89293a057740de681ac9abbe
      name: example-namespace
  customerWorker1:
    type: cloudflare:WorkersScript
    name: customer_worker_1
    properties:
      accountId: f037e56e89293a057740de681ac9abbe
      name: customer-worker-1
      content:
        fn::invoke:
          function: std:file
          arguments:
            input: script.js
          return: result
      dispatchNamespace: ${example.name}
      tags:
        - free
Copy

Create WorkersForPlatformsDispatchNamespace Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new WorkersForPlatformsDispatchNamespace(name: string, args: WorkersForPlatformsDispatchNamespaceArgs, opts?: CustomResourceOptions);
@overload
def WorkersForPlatformsDispatchNamespace(resource_name: str,
                                         args: WorkersForPlatformsDispatchNamespaceArgs,
                                         opts: Optional[ResourceOptions] = None)

@overload
def WorkersForPlatformsDispatchNamespace(resource_name: str,
                                         opts: Optional[ResourceOptions] = None,
                                         account_id: Optional[str] = None,
                                         name: Optional[str] = None)
func NewWorkersForPlatformsDispatchNamespace(ctx *Context, name string, args WorkersForPlatformsDispatchNamespaceArgs, opts ...ResourceOption) (*WorkersForPlatformsDispatchNamespace, error)
public WorkersForPlatformsDispatchNamespace(string name, WorkersForPlatformsDispatchNamespaceArgs args, CustomResourceOptions? opts = null)
public WorkersForPlatformsDispatchNamespace(String name, WorkersForPlatformsDispatchNamespaceArgs args)
public WorkersForPlatformsDispatchNamespace(String name, WorkersForPlatformsDispatchNamespaceArgs args, CustomResourceOptions options)
type: cloudflare:WorkersForPlatformsDispatchNamespace
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. WorkersForPlatformsDispatchNamespaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. WorkersForPlatformsDispatchNamespaceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersForPlatformsDispatchNamespaceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. WorkersForPlatformsDispatchNamespaceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. WorkersForPlatformsDispatchNamespaceArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var workersForPlatformsDispatchNamespaceResource = new Cloudflare.WorkersForPlatformsDispatchNamespace("workersForPlatformsDispatchNamespaceResource", new()
{
    AccountId = "string",
    Name = "string",
});
Copy
example, err := cloudflare.NewWorkersForPlatformsDispatchNamespace(ctx, "workersForPlatformsDispatchNamespaceResource", &cloudflare.WorkersForPlatformsDispatchNamespaceArgs{
	AccountId: pulumi.String("string"),
	Name:      pulumi.String("string"),
})
Copy
var workersForPlatformsDispatchNamespaceResource = new WorkersForPlatformsDispatchNamespace("workersForPlatformsDispatchNamespaceResource", WorkersForPlatformsDispatchNamespaceArgs.builder()
    .accountId("string")
    .name("string")
    .build());
Copy
workers_for_platforms_dispatch_namespace_resource = cloudflare.WorkersForPlatformsDispatchNamespace("workersForPlatformsDispatchNamespaceResource",
    account_id="string",
    name="string")
Copy
const workersForPlatformsDispatchNamespaceResource = new cloudflare.WorkersForPlatformsDispatchNamespace("workersForPlatformsDispatchNamespaceResource", {
    accountId: "string",
    name: "string",
});
Copy
type: cloudflare:WorkersForPlatformsDispatchNamespace
properties:
    accountId: string
    name: string
Copy

WorkersForPlatformsDispatchNamespace Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The WorkersForPlatformsDispatchNamespace resource accepts the following input properties:

AccountId This property is required. string
The account identifier to target for the resource.
Name This property is required. string
The name of the Workers for Platforms namespace.
AccountId This property is required. string
The account identifier to target for the resource.
Name This property is required. string
The name of the Workers for Platforms namespace.
accountId This property is required. String
The account identifier to target for the resource.
name This property is required. String
The name of the Workers for Platforms namespace.
accountId This property is required. string
The account identifier to target for the resource.
name This property is required. string
The name of the Workers for Platforms namespace.
account_id This property is required. str
The account identifier to target for the resource.
name This property is required. str
The name of the Workers for Platforms namespace.
accountId This property is required. String
The account identifier to target for the resource.
name This property is required. String
The name of the Workers for Platforms namespace.

Outputs

All input properties are implicitly available as output properties. Additionally, the WorkersForPlatformsDispatchNamespace resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing WorkersForPlatformsDispatchNamespace Resource

Get an existing WorkersForPlatformsDispatchNamespace resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: WorkersForPlatformsDispatchNamespaceState, opts?: CustomResourceOptions): WorkersForPlatformsDispatchNamespace
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_id: Optional[str] = None,
        name: Optional[str] = None) -> WorkersForPlatformsDispatchNamespace
func GetWorkersForPlatformsDispatchNamespace(ctx *Context, name string, id IDInput, state *WorkersForPlatformsDispatchNamespaceState, opts ...ResourceOption) (*WorkersForPlatformsDispatchNamespace, error)
public static WorkersForPlatformsDispatchNamespace Get(string name, Input<string> id, WorkersForPlatformsDispatchNamespaceState? state, CustomResourceOptions? opts = null)
public static WorkersForPlatformsDispatchNamespace get(String name, Output<String> id, WorkersForPlatformsDispatchNamespaceState state, CustomResourceOptions options)
resources:  _:    type: cloudflare:WorkersForPlatformsDispatchNamespace    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountId string
The account identifier to target for the resource.
Name string
The name of the Workers for Platforms namespace.
AccountId string
The account identifier to target for the resource.
Name string
The name of the Workers for Platforms namespace.
accountId String
The account identifier to target for the resource.
name String
The name of the Workers for Platforms namespace.
accountId string
The account identifier to target for the resource.
name string
The name of the Workers for Platforms namespace.
account_id str
The account identifier to target for the resource.
name str
The name of the Workers for Platforms namespace.
accountId String
The account identifier to target for the resource.
name String
The name of the Workers for Platforms namespace.

Import

$ pulumi import cloudflare:index/workersForPlatformsDispatchNamespace:WorkersForPlatformsDispatchNamespace example <account_id>/<namespace_name>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Cloudflare pulumi/pulumi-cloudflare
License
Apache-2.0
Notes
This Pulumi package is based on the cloudflare Terraform Provider.