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

com.pulumi.cloudflare.kotlin.WorkersForPlatformsNamespace.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.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

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

    public var args: WorkersForPlatformsNamespaceArgs = WorkersForPlatformsNamespaceArgs()

    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 WorkersForPlatformsNamespaceArgsBuilder.() -> Unit) {
        val builder = WorkersForPlatformsNamespaceArgsBuilder()
        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(): WorkersForPlatformsNamespace {
        val builtJavaResource =
            com.pulumi.cloudflare.WorkersForPlatformsNamespace(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return WorkersForPlatformsNamespace(builtJavaResource)
    }
}

/**
 * The [Workers for Platforms](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/) resource allows you
 * to manage Cloudflare Workers for Platforms namespaces.
 * ## Example Usage
 * 
 * ```typescript
 * 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.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"],
 * });
 * ```
 * ```python
 * 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.WorkersScript("customer_worker_1",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     name="customer-worker-1",
 *     content=std.file(input="script.js").result,
 *     dispatch_namespace=example.name,
 *     tags=["free"])
 * ```
 * ```csharp
 * 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.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",
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		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.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
 * 	})
 * }
 * ```
 * ```java
 * 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.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 WorkersForPlatformsNamespace("example", WorkersForPlatformsNamespaceArgs.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());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: cloudflare:WorkersForPlatformsNamespace
 *     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
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/workersForPlatformsNamespace:WorkersForPlatformsNamespace example /
 * ```
 */
public class WorkersForPlatformsNamespace internal constructor(
    override val javaResource: com.pulumi.cloudflare.WorkersForPlatformsNamespace,
) : KotlinCustomResource(javaResource, WorkersForPlatformsNamespaceMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * The name of the Workers for Platforms namespace.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy