com.pulumi.cloudflare.kotlin.BotManagement.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.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 [BotManagement].
*/
@PulumiTagMarker
public class BotManagementResourceBuilder internal constructor() {
public var name: String? = null
public var args: BotManagementArgs = BotManagementArgs()
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 BotManagementArgsBuilder.() -> Unit) {
val builder = BotManagementArgsBuilder()
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(): BotManagement {
val builtJavaResource = com.pulumi.cloudflare.BotManagement(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return BotManagement(builtJavaResource)
}
}
/**
* Provides a resource to configure Bot Management.
* Specifically, this resource can be used to manage:
* - **Bot Fight Mode**
* - **Super Bot Fight Mode**
* - **Bot Management for Enterprise**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as cloudflare from "@pulumi/cloudflare";
* const example = new cloudflare.BotManagement("example", {
* zoneId: "0da42c8d2132a9ddaf714f9e7c920711",
* enableJs: true,
* sbfmDefinitelyAutomated: "block",
* sbfmLikelyAutomated: "managed_challenge",
* sbfmVerifiedBots: "allow",
* sbfmStaticResourceProtection: false,
* optimizeWordpress: true,
* });
* ```
* ```python
* import pulumi
* import pulumi_cloudflare as cloudflare
* example = cloudflare.BotManagement("example",
* zone_id="0da42c8d2132a9ddaf714f9e7c920711",
* enable_js=True,
* sbfm_definitely_automated="block",
* sbfm_likely_automated="managed_challenge",
* sbfm_verified_bots="allow",
* sbfm_static_resource_protection=False,
* optimize_wordpress=True)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Cloudflare = Pulumi.Cloudflare;
* return await Deployment.RunAsync(() =>
* {
* var example = new Cloudflare.BotManagement("example", new()
* {
* ZoneId = "0da42c8d2132a9ddaf714f9e7c920711",
* EnableJs = true,
* SbfmDefinitelyAutomated = "block",
* SbfmLikelyAutomated = "managed_challenge",
* SbfmVerifiedBots = "allow",
* SbfmStaticResourceProtection = false,
* OptimizeWordpress = true,
* });
* });
* ```
* ```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.NewBotManagement(ctx, "example", &cloudflare.BotManagementArgs{
* ZoneId: pulumi.String("0da42c8d2132a9ddaf714f9e7c920711"),
* EnableJs: pulumi.Bool(true),
* SbfmDefinitelyAutomated: pulumi.String("block"),
* SbfmLikelyAutomated: pulumi.String("managed_challenge"),
* SbfmVerifiedBots: pulumi.String("allow"),
* SbfmStaticResourceProtection: pulumi.Bool(false),
* OptimizeWordpress: pulumi.Bool(true),
* })
* 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.BotManagement;
* import com.pulumi.cloudflare.BotManagementArgs;
* 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 BotManagement("example", BotManagementArgs.builder()
* .zoneId("0da42c8d2132a9ddaf714f9e7c920711")
* .enableJs(true)
* .sbfmDefinitelyAutomated("block")
* .sbfmLikelyAutomated("managed_challenge")
* .sbfmVerifiedBots("allow")
* .sbfmStaticResourceProtection(false)
* .optimizeWordpress(true)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: cloudflare:BotManagement
* properties:
* zoneId: 0da42c8d2132a9ddaf714f9e7c920711
* enableJs: true
* sbfmDefinitelyAutomated: block
* sbfmLikelyAutomated: managed_challenge
* sbfmVerifiedBots: allow
* sbfmStaticResourceProtection: false
* optimizeWordpress: true
* ```
*
* ## Import
* ```sh
* $ pulumi import cloudflare:index/botManagement:BotManagement example
* ```
*/
public class BotManagement internal constructor(
override val javaResource: com.pulumi.cloudflare.BotManagement,
) : KotlinCustomResource(javaResource, BotManagementMapper) {
/**
* Automatically update to the newest bot detection models created by Cloudflare as they are released. [Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes).
*/
public val autoUpdateModel: Output?
get() = javaResource.autoUpdateModel().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Use lightweight, invisible JavaScript detections to improve Bot Management. [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
*/
public val enableJs: Output?
get() = javaResource.enableJs().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Whether to enable Bot Fight Mode.
*/
public val fightMode: Output?
get() = javaResource.fightMode().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* Whether to optimize Super Bot Fight Mode protections for Wordpress.
*/
public val optimizeWordpress: Output?
get() = javaResource.optimizeWordpress().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Super Bot Fight Mode (SBFM) action to take on definitely automated requests.
*/
public val sbfmDefinitelyAutomated: Output?
get() = javaResource.sbfmDefinitelyAutomated().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Super Bot Fight Mode (SBFM) action to take on likely automated requests.
*/
public val sbfmLikelyAutomated: Output?
get() = javaResource.sbfmLikelyAutomated().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if static resources on your application need bot protection. Note: Static resource protection can also result in legitimate traffic being blocked.
*/
public val sbfmStaticResourceProtection: Output?
get() = javaResource.sbfmStaticResourceProtection().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Super Bot Fight Mode (SBFM) action to take on verified bots requests.
*/
public val sbfmVerifiedBots: Output?
get() = javaResource.sbfmVerifiedBots().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Whether to disable tracking the highest bot score for a session in the Bot Management cookie.
*/
public val suppressSessionScore: Output?
get() = javaResource.suppressSessionScore().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A read-only field that indicates whether the zone currently is running the latest ML model.
*/
public val usingLatestModel: Output
get() = javaResource.usingLatestModel().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 BotManagementMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.cloudflare.BotManagement::class == javaResource::class
override fun map(javaResource: Resource): BotManagement = BotManagement(
javaResource as
com.pulumi.cloudflare.BotManagement,
)
}
/**
* @see [BotManagement].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [BotManagement].
*/
public suspend fun botManagement(
name: String,
block: suspend BotManagementResourceBuilder.() -> Unit,
): BotManagement {
val builder = BotManagementResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [BotManagement].
* @param name The _unique_ name of the resulting resource.
*/
public fun botManagement(name: String): BotManagement {
val builder = BotManagementResourceBuilder()
builder.name(name)
return builder.build()
}