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

com.pulumi.cloudflare.kotlin.UserAgentBlockingRule.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.cloudflare.kotlin.outputs.UserAgentBlockingRuleConfiguration
import com.pulumi.cloudflare.kotlin.outputs.UserAgentBlockingRuleConfiguration.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.String
import kotlin.Suppress
import kotlin.Unit

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

    public var args: UserAgentBlockingRuleArgs = UserAgentBlockingRuleArgs()

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

/**
 * Provides a resource to manage User Agent Blocking Rules.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const example1 = new cloudflare.UserAgentBlockingRule("example_1", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     mode: "js_challenge",
 *     paused: false,
 *     description: "My description 1",
 *     configuration: {
 *         target: "ua",
 *         value: "Chrome",
 *     },
 * });
 * const example2 = new cloudflare.UserAgentBlockingRule("example_2", {
 *     zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
 *     mode: "challenge",
 *     paused: true,
 *     description: "My description 22",
 *     configuration: {
 *         target: "ua",
 *         value: "Mozilla",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * example1 = cloudflare.UserAgentBlockingRule("example_1",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     mode="js_challenge",
 *     paused=False,
 *     description="My description 1",
 *     configuration={
 *         "target": "ua",
 *         "value": "Chrome",
 *     })
 * example2 = cloudflare.UserAgentBlockingRule("example_2",
 *     zone_id="0da42c8d2132a9ddaf714f9e7c920711",
 *     mode="challenge",
 *     paused=True,
 *     description="My description 22",
 *     configuration={
 *         "target": "ua",
 *         "value": "Mozilla",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example1 = new Cloudflare.UserAgentBlockingRule("example_1", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Mode = "js_challenge",
 *         Paused = false,
 *         Description = "My description 1",
 *         Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
 *         {
 *             Target = "ua",
 *             Value = "Chrome",
 *         },
 *     });
 *     var example2 = new Cloudflare.UserAgentBlockingRule("example_2", new()
 *     {
 *         ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
 *         Mode = "challenge",
 *         Paused = true,
 *         Description = "My description 22",
 *         Configuration = new Cloudflare.Inputs.UserAgentBlockingRuleConfigurationArgs
 *         {
 *             Target = "ua",
 *             Value = "Mozilla",
 *         },
 *     });
 * });
 * ```
 * ```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 {
 * 		_, err := cloudflare.NewUserAgentBlockingRule(ctx, "example_1", &cloudflare.UserAgentBlockingRuleArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Mode:        pulumi.String("js_challenge"),
 * 			Paused:      pulumi.Bool(false),
 * 			Description: pulumi.String("My description 1"),
 * 			Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
 * 				Target: pulumi.String("ua"),
 * 				Value:  pulumi.String("Chrome"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = cloudflare.NewUserAgentBlockingRule(ctx, "example_2", &cloudflare.UserAgentBlockingRuleArgs{
 * 			ZoneId:      pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
 * 			Mode:        pulumi.String("challenge"),
 * 			Paused:      pulumi.Bool(true),
 * 			Description: pulumi.String("My description 22"),
 * 			Configuration: &cloudflare.UserAgentBlockingRuleConfigurationArgs{
 * 				Target: pulumi.String("ua"),
 * 				Value:  pulumi.String("Mozilla"),
 * 			},
 * 		})
 * 		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.UserAgentBlockingRule;
 * import com.pulumi.cloudflare.UserAgentBlockingRuleArgs;
 * import com.pulumi.cloudflare.inputs.UserAgentBlockingRuleConfigurationArgs;
 * 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 example1 = new UserAgentBlockingRule("example1", UserAgentBlockingRuleArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .mode("js_challenge")
 *             .paused(false)
 *             .description("My description 1")
 *             .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
 *                 .target("ua")
 *                 .value("Chrome")
 *                 .build())
 *             .build());
 *         var example2 = new UserAgentBlockingRule("example2", UserAgentBlockingRuleArgs.builder()
 *             .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
 *             .mode("challenge")
 *             .paused(true)
 *             .description("My description 22")
 *             .configuration(UserAgentBlockingRuleConfigurationArgs.builder()
 *                 .target("ua")
 *                 .value("Mozilla")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example1:
 *     type: cloudflare:UserAgentBlockingRule
 *     name: example_1
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       mode: js_challenge
 *       paused: false
 *       description: My description 1
 *       configuration:
 *         target: ua
 *         value: Chrome
 *   example2:
 *     type: cloudflare:UserAgentBlockingRule
 *     name: example_2
 *     properties:
 *       zoneId: 0da42c8d2132a9ddaf714f9e7c920711
 *       mode: challenge
 *       paused: true
 *       description: My description 22
 *       configuration:
 *         target: ua
 *         value: Mozilla
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/userAgentBlockingRule:UserAgentBlockingRule example /
 * ```
 */
public class UserAgentBlockingRule internal constructor(
    override val javaResource: com.pulumi.cloudflare.UserAgentBlockingRule,
) : KotlinCustomResource(javaResource, UserAgentBlockingRuleMapper) {
    /**
     * The configuration object for the current rule.
     */
    public val configuration: Output
        get() = javaResource.configuration().applyValue({ args0 ->
            args0.let({ args0 ->
                toKotlin(args0)
            })
        })

    /**
     * An informative summary of the rule.
     */
    public val description: Output
        get() = javaResource.description().applyValue({ args0 -> args0 })

    /**
     * The action to apply to a matched request. Available values: `block`, `challenge`, `js_challenge`, `managed_challenge`.
     */
    public val mode: Output
        get() = javaResource.mode().applyValue({ args0 -> args0 })

    /**
     * When true, indicates that the rule is currently paused.
     */
    public val paused: Output
        get() = javaResource.paused().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 UserAgentBlockingRuleMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.UserAgentBlockingRule::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy