1. Packages
  2. Cloudflare
  3. API Docs
  4. WorkersForPlatformsNamespace
Cloudflare v5.34.0 published on Friday, Jul 12, 2024 by Pulumi

cloudflare.WorkersForPlatformsNamespace

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.34.0 published on Friday, Jul 12, 2024 by Pulumi

    The Workers for Platforms resource allows you to manage Cloudflare Workers for Platforms 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.WorkersForPlatformsNamespace("example", {
        accountId: "f037e56e89293a057740de681ac9abbe",
        name: "example-namespace",
    });
    const customerWorker1 = new cloudflare.WorkerScript("customer_worker_1", {
        accountId: "f037e56e89293a057740de681ac9abbe",
        name: "customer-worker-1",
        content: std.file({
            input: "script.js",
        }).then(invoke => invoke.result),
        dispatchNamespace: example.name,
        tags: ["free"],
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    import pulumi_std as std
    
    example = cloudflare.WorkersForPlatformsNamespace("example",
        account_id="f037e56e89293a057740de681ac9abbe",
        name="example-namespace")
    customer_worker1 = cloudflare.WorkerScript("customer_worker_1",
        account_id="f037e56e89293a057740de681ac9abbe",
        name="customer-worker-1",
        content=std.file(input="script.js").result,
        dispatch_namespace=example.name,
        tags=["free"])
    
    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.NewWorkersForPlatformsNamespace(ctx, "example", &cloudflare.WorkersForPlatformsNamespaceArgs{
    			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.NewWorkerScript(ctx, "customer_worker_1", &cloudflare.WorkerScriptArgs{
    			AccountId:         pulumi.String("f037e56e89293a057740de681ac9abbe"),
    			Name:              pulumi.String("customer-worker-1"),
    			Content:           invokeFile.Result,
    			DispatchNamespace: example.Name,
    			Tags: pulumi.StringArray{
    				pulumi.String("free"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.WorkersForPlatformsNamespace("example", new()
        {
            AccountId = "f037e56e89293a057740de681ac9abbe",
            Name = "example-namespace",
        });
    
        var customerWorker1 = new Cloudflare.WorkerScript("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",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.WorkersForPlatformsNamespace;
    import com.pulumi.cloudflare.WorkersForPlatformsNamespaceArgs;
    import com.pulumi.cloudflare.WorkerScript;
    import com.pulumi.cloudflare.WorkerScriptArgs;
    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 WorkersForPlatformsNamespace("example", WorkersForPlatformsNamespaceArgs.builder()
                .accountId("f037e56e89293a057740de681ac9abbe")
                .name("example-namespace")
                .build());
    
            var customerWorker1 = new WorkerScript("customerWorker1", WorkerScriptArgs.builder()
                .accountId("f037e56e89293a057740de681ac9abbe")
                .name("customer-worker-1")
                .content(StdFunctions.file(FileArgs.builder()
                    .input("script.js")
                    .build()).result())
                .dispatchNamespace(example.name())
                .tags("free")
                .build());
    
        }
    }
    
    resources:
      example:
        type: cloudflare:WorkersForPlatformsNamespace
        properties:
          accountId: f037e56e89293a057740de681ac9abbe
          name: example-namespace
      customerWorker1:
        type: cloudflare:WorkerScript
        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
    

    Create WorkersForPlatformsNamespace Resource

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

    Constructor syntax

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

    Parameters

    name string
    The unique name of the resource.
    args WorkersForPlatformsNamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args WorkersForPlatformsNamespaceArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args WorkersForPlatformsNamespaceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args WorkersForPlatformsNamespaceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args WorkersForPlatformsNamespaceArgs
    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 workersForPlatformsNamespaceResource = new Cloudflare.WorkersForPlatformsNamespace("workersForPlatformsNamespaceResource", new()
    {
        AccountId = "string",
        Name = "string",
    });
    
    example, err := cloudflare.NewWorkersForPlatformsNamespace(ctx, "workersForPlatformsNamespaceResource", &cloudflare.WorkersForPlatformsNamespaceArgs{
    	AccountId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    })
    
    var workersForPlatformsNamespaceResource = new WorkersForPlatformsNamespace("workersForPlatformsNamespaceResource", WorkersForPlatformsNamespaceArgs.builder()
        .accountId("string")
        .name("string")
        .build());
    
    workers_for_platforms_namespace_resource = cloudflare.WorkersForPlatformsNamespace("workersForPlatformsNamespaceResource",
        account_id="string",
        name="string")
    
    const workersForPlatformsNamespaceResource = new cloudflare.WorkersForPlatformsNamespace("workersForPlatformsNamespaceResource", {
        accountId: "string",
        name: "string",
    });
    
    type: cloudflare:WorkersForPlatformsNamespace
    properties:
        accountId: string
        name: string
    

    WorkersForPlatformsNamespace Resource Properties

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

    Inputs

    The WorkersForPlatformsNamespace resource accepts the following input properties:

    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.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the WorkersForPlatformsNamespace 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 WorkersForPlatformsNamespace Resource

    Get an existing WorkersForPlatformsNamespace 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?: WorkersForPlatformsNamespaceState, opts?: CustomResourceOptions): WorkersForPlatformsNamespace
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            name: Optional[str] = None) -> WorkersForPlatformsNamespace
    func GetWorkersForPlatformsNamespace(ctx *Context, name string, id IDInput, state *WorkersForPlatformsNamespaceState, opts ...ResourceOption) (*WorkersForPlatformsNamespace, error)
    public static WorkersForPlatformsNamespace Get(string name, Input<string> id, WorkersForPlatformsNamespaceState? state, CustomResourceOptions? opts = null)
    public static WorkersForPlatformsNamespace get(String name, Output<String> id, WorkersForPlatformsNamespaceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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/workersForPlatformsNamespace:WorkersForPlatformsNamespace example <account_id>/<namespace_name>
    

    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.
    cloudflare logo
    Cloudflare v5.34.0 published on Friday, Jul 12, 2024 by Pulumi