com.pulumi.cloudflare.kotlin.UserAgentBlockingRuleArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-cloudflare-kotlin Show documentation
Show all versions of pulumi-cloudflare-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.cloudflare.kotlin
import com.pulumi.cloudflare.UserAgentBlockingRuleArgs.builder
import com.pulumi.cloudflare.kotlin.inputs.UserAgentBlockingRuleConfigurationArgs
import com.pulumi.cloudflare.kotlin.inputs.UserAgentBlockingRuleConfigurationArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.jvm.JvmName
/**
* 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 /
* ```
* @property configuration The configuration object for the current rule.
* @property description An informative summary of the rule.
* @property mode The action to apply to a matched request. Available values: `block`, `challenge`, `js_challenge`, `managed_challenge`.
* @property paused When true, indicates that the rule is currently paused.
* @property zoneId The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
*/
public data class UserAgentBlockingRuleArgs(
public val configuration: Output? = null,
public val description: Output? = null,
public val mode: Output? = null,
public val paused: Output? = null,
public val zoneId: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.cloudflare.UserAgentBlockingRuleArgs =
com.pulumi.cloudflare.UserAgentBlockingRuleArgs.builder()
.configuration(configuration?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
.description(description?.applyValue({ args0 -> args0 }))
.mode(mode?.applyValue({ args0 -> args0 }))
.paused(paused?.applyValue({ args0 -> args0 }))
.zoneId(zoneId?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [UserAgentBlockingRuleArgs].
*/
@PulumiTagMarker
public class UserAgentBlockingRuleArgsBuilder internal constructor() {
private var configuration: Output? = null
private var description: Output? = null
private var mode: Output? = null
private var paused: Output? = null
private var zoneId: Output? = null
/**
* @param value The configuration object for the current rule.
*/
@JvmName("rtkpneaktbnspwid")
public suspend fun configuration(`value`: Output) {
this.configuration = value
}
/**
* @param value An informative summary of the rule.
*/
@JvmName("wjhkgwwbidtuuaex")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value The action to apply to a matched request. Available values: `block`, `challenge`, `js_challenge`, `managed_challenge`.
*/
@JvmName("dvccwicgikrtqbwe")
public suspend fun mode(`value`: Output) {
this.mode = value
}
/**
* @param value When true, indicates that the rule is currently paused.
*/
@JvmName("mjulukpnpwuncmtm")
public suspend fun paused(`value`: Output) {
this.paused = value
}
/**
* @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
*/
@JvmName("onuoghldgccgouuk")
public suspend fun zoneId(`value`: Output) {
this.zoneId = value
}
/**
* @param value The configuration object for the current rule.
*/
@JvmName("aouqwkppqgmywkkn")
public suspend fun configuration(`value`: UserAgentBlockingRuleConfigurationArgs?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.configuration = mapped
}
/**
* @param argument The configuration object for the current rule.
*/
@JvmName("gbkqgwfpbtiipdiw")
public suspend fun configuration(argument: suspend UserAgentBlockingRuleConfigurationArgsBuilder.() -> Unit) {
val toBeMapped = UserAgentBlockingRuleConfigurationArgsBuilder().applySuspend {
argument()
}.build()
val mapped = of(toBeMapped)
this.configuration = mapped
}
/**
* @param value An informative summary of the rule.
*/
@JvmName("ctwbpmhchigvmbef")
public suspend fun description(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.description = mapped
}
/**
* @param value The action to apply to a matched request. Available values: `block`, `challenge`, `js_challenge`, `managed_challenge`.
*/
@JvmName("nniywsufrwnhrltw")
public suspend fun mode(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.mode = mapped
}
/**
* @param value When true, indicates that the rule is currently paused.
*/
@JvmName("wasatupxxijoruru")
public suspend fun paused(`value`: Boolean?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.paused = mapped
}
/**
* @param value The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
*/
@JvmName("olorgdhbwjnpndko")
public suspend fun zoneId(`value`: String?) {
val toBeMapped = value
val mapped = toBeMapped?.let({ args0 -> of(args0) })
this.zoneId = mapped
}
internal fun build(): UserAgentBlockingRuleArgs = UserAgentBlockingRuleArgs(
configuration = configuration,
description = description,
mode = mode,
paused = paused,
zoneId = zoneId,
)
}