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

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

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.WaitingRoomAdditionalRoute
import com.pulumi.cloudflare.kotlin.outputs.WaitingRoomAdditionalRoute.Companion.toKotlin
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: WaitingRoomArgs = WaitingRoomArgs()

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

/**
 * Provides a Cloudflare Waiting Room resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * // Waiting Room
 * const example = new cloudflare.WaitingRoom("example", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     name: "foo",
 *     host: "foo.example.com",
 *     path: "/",
 *     newUsersPerMinute: 200,
 *     totalActiveUsers: 200,
 *     cookieSuffix: "queue1",
 *     additionalRoutes: [
 *         {
 *             host: "shop1.example.com",
 *             path: "/example-path",
 *         },
 *         {
 *             host: "shop2.example.com",
 *         },
 *     ],
 *     queueingStatusCode: 200,
 *     enabledOriginCommands: ["revoke"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * # Waiting Room
 * example = cloudflare.WaitingRoom("example",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     name="foo",
 *     host="foo.example.com",
 *     path="/",
 *     new_users_per_minute=200,
 *     total_active_users=200,
 *     cookie_suffix="queue1",
 *     additional_routes=[
 *         {
 *             "host": "shop1.example.com",
 *             "path": "/example-path",
 *         },
 *         {
 *             "host": "shop2.example.com",
 *         },
 *     ],
 *     queueing_status_code=200,
 *     enabled_origin_commands=["revoke"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     // Waiting Room
 *     var example = new Cloudflare.WaitingRoom("example", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Name = "foo",
 *         Host = "foo.example.com",
 *         Path = "/",
 *         NewUsersPerMinute = 200,
 *         TotalActiveUsers = 200,
 *         CookieSuffix = "queue1",
 *         AdditionalRoutes = new[]
 *         {
 *             new Cloudflare.Inputs.WaitingRoomAdditionalRouteArgs
 *             {
 *                 Host = "shop1.example.com",
 *                 Path = "/example-path",
 *             },
 *             new Cloudflare.Inputs.WaitingRoomAdditionalRouteArgs
 *             {
 *                 Host = "shop2.example.com",
 *             },
 *         },
 *         QueueingStatusCode = 200,
 *         EnabledOriginCommands = new[]
 *         {
 *             "revoke",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		// Waiting Room
 * 		_, err := cloudflare.NewWaitingRoom(ctx, "example", &cloudflare.WaitingRoomArgs{
 * 			ZoneId:            pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Name:              pulumi.String("foo"),
 * 			Host:              pulumi.String("foo.example.com"),
 * 			Path:              pulumi.String("/"),
 * 			NewUsersPerMinute: pulumi.Int(200),
 * 			TotalActiveUsers:  pulumi.Int(200),
 * 			CookieSuffix:      pulumi.String("queue1"),
 * 			AdditionalRoutes: cloudflare.WaitingRoomAdditionalRouteArray{
 * 				&cloudflare.WaitingRoomAdditionalRouteArgs{
 * 					Host: pulumi.String("shop1.example.com"),
 * 					Path: pulumi.String("/example-path"),
 * 				},
 * 				&cloudflare.WaitingRoomAdditionalRouteArgs{
 * 					Host: pulumi.String("shop2.example.com"),
 * 				},
 * 			},
 * 			QueueingStatusCode: pulumi.Int(200),
 * 			EnabledOriginCommands: pulumi.StringArray{
 * 				pulumi.String("revoke"),
 * 			},
 * 		})
 * 		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.WaitingRoom;
 * import com.pulumi.cloudflare.WaitingRoomArgs;
 * import com.pulumi.cloudflare.inputs.WaitingRoomAdditionalRouteArgs;
 * 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) {
 *         // Waiting Room
 *         var example = new WaitingRoom("example", WaitingRoomArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .name("foo")
 *             .host("foo.example.com")
 *             .path("/")
 *             .newUsersPerMinute(200)
 *             .totalActiveUsers(200)
 *             .cookieSuffix("queue1")
 *             .additionalRoutes(
 *                 WaitingRoomAdditionalRouteArgs.builder()
 *                     .host("shop1.example.com")
 *                     .path("/example-path")
 *                     .build(),
 *                 WaitingRoomAdditionalRouteArgs.builder()
 *                     .host("shop2.example.com")
 *                     .build())
 *             .queueingStatusCode(200)
 *             .enabledOriginCommands("revoke")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   # Waiting Room
 *   example:
 *     type: cloudflare:WaitingRoom
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       name: foo
 *       host: foo.example.com
 *       path: /
 *       newUsersPerMinute: 200
 *       totalActiveUsers: 200
 *       cookieSuffix: queue1
 *       additionalRoutes:
 *         - host: shop1.example.com
 *           path: /example-path
 *         - host: shop2.example.com
 *       queueingStatusCode: 200
 *       enabledOriginCommands:
 *         - revoke
 * ```
 * 
 * ## Import
 * Use the Zone ID and Waiting Room ID to import.
 * ```sh
 * $ pulumi import cloudflare:index/waitingRoom:WaitingRoom default /
 * ```
 */
public class WaitingRoom internal constructor(
    override val javaResource: com.pulumi.cloudflare.WaitingRoom,
) : KotlinCustomResource(javaResource, WaitingRoomMapper) {
    /**
     * A list of additional hostname and paths combination to be applied on the waiting room.
     */
    public val additionalRoutes: Output>?
        get() = javaResource.additionalRoutes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
            }).orElse(null)
        })

    /**
     * A cookie suffix to be appended to the Cloudflare waiting room cookie name.
     */
    public val cookieSuffix: Output?
        get() = javaResource.cookieSuffix().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * This is a templated html file that will be rendered at the edge.
     */
    public val customPageHtml: Output?
        get() = javaResource.customPageHtml().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The language to use for the default waiting room page. Available values: `de-DE`, `es-ES`, `en-US`, `fr-FR`, `id-ID`, `it-IT`, `ja-JP`, `ko-KR`, `nl-NL`, `pl-PL`, `pt-BR`, `tr-TR`, `zh-CN`, `zh-TW`, `ru-RU`, `fa-IR`. Defaults to `en-US`.
     */
    public val defaultTemplateLanguage: Output?
        get() = javaResource.defaultTemplateLanguage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A description to add more details about the waiting room.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Disables automatic renewal of session cookies.
     */
    public val disableSessionRenewal: Output?
        get() = javaResource.disableSessionRenewal().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The list of enabled origin commands for the waiting room. Available values: `revoke`.
     */
    public val enabledOriginCommands: Output>?
        get() = javaResource.enabledOriginCommands().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Host name for which the waiting room will be applied (no wildcards).
     */
    public val host: Output
        get() = javaResource.host().applyValue({ args0 -> args0 })

    /**
     * If true, requests to the waiting room with the header `Accept: application/json` will receive a JSON response object.
     */
    public val jsonResponseEnabled: Output?
        get() = javaResource.jsonResponseEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * A unique name to identify the waiting room. **Modifying this attribute will force creation of a new resource.**
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The number of new users that will be let into the route every minute.
     */
    public val newUsersPerMinute: Output
        get() = javaResource.newUsersPerMinute().applyValue({ args0 -> args0 })

    /**
     * The path within the host to enable the waiting room on. Defaults to `/`.
     */
    public val path: Output?
        get() = javaResource.path().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * If queue_all is true, then all traffic will be sent to the waiting room.
     */
    public val queueAll: Output?
        get() = javaResource.queueAll().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The queueing method used by the waiting room. Available values: `fifo`, `random`, `passthrough`, `reject`. Defaults to `fifo`.
     */
    public val queueingMethod: Output?
        get() = javaResource.queueingMethod().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * HTTP status code returned to a user while in the queue. Defaults to `200`.
     */
    public val queueingStatusCode: Output?
        get() = javaResource.queueingStatusCode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Lifetime of a cookie (in minutes) set by Cloudflare for users who get access to the origin. Defaults to `5`.
     */
    public val sessionDuration: Output?
        get() = javaResource.sessionDuration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Suspends the waiting room.
     */
    public val suspended: Output?
        get() = javaResource.suspended().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The total number of active user sessions on the route at a point in time.
     */
    public val totalActiveUsers: Output
        get() = javaResource.totalActiveUsers().applyValue({ args0 -> args0 })

    /**
     * The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    public val zoneId: Output
        get() = javaResource.zoneId().applyValue({ args0 -> args0 })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy