RateLimitArgs

data class RateLimitArgs(val action: Output<RateLimitActionArgs>? = null, val bypassUrlPatterns: Output<List<String>>? = null, val correlate: Output<RateLimitCorrelateArgs>? = null, val description: Output<String>? = null, val disabled: Output<Boolean>? = null, val match: Output<RateLimitMatchArgs>? = null, val period: Output<Int>? = null, val threshold: Output<Int>? = null, val zoneId: Output<String>? = null) : ConvertibleToJava<RateLimitArgs>

Provides a Cloudflare rate limit resource for a given zone. This can be used to limit the traffic you receive zone-wide, or matching more specific types of requests/responses.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudflare.RateLimit;
import com.pulumi.cloudflare.RateLimitArgs;
import com.pulumi.cloudflare.inputs.RateLimitActionArgs;
import com.pulumi.cloudflare.inputs.RateLimitActionResponseArgs;
import com.pulumi.cloudflare.inputs.RateLimitCorrelateArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchRequestArgs;
import com.pulumi.cloudflare.inputs.RateLimitMatchResponseArgs;
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 RateLimit("example", RateLimitArgs.builder()
.action(RateLimitActionArgs.builder()
.mode("simulate")
.response(RateLimitActionResponseArgs.builder()
.body("custom response body")
.contentType("text/plain")
.build())
.timeout(43200)
.build())
.bypassUrlPatterns(
"example.com/bypass1",
"example.com/bypass2")
.correlate(RateLimitCorrelateArgs.builder()
.by("nat")
.build())
.description("example rate limit for a zone")
.disabled(false)
.match(RateLimitMatchArgs.builder()
.request(RateLimitMatchRequestArgs.builder()
.methods(
"GET",
"POST",
"PUT",
"DELETE",
"PATCH",
"HEAD")
.schemes(
"HTTP",
"HTTPS")
.urlPattern(String.format("%s/*", var_.cloudflare_zone()))
.build())
.response(RateLimitMatchResponseArgs.builder()
.headers(
Map.ofEntries(
Map.entry("name", "Host"),
Map.entry("op", "eq"),
Map.entry("value", "localhost")
),
Map.ofEntries(
Map.entry("name", "X-Example"),
Map.entry("op", "ne"),
Map.entry("value", "my-example")
))
.originTraffic(false)
.statuses(
200,
201,
202,
301,
429)
.build())
.build())
.period(2)
.threshold(2000)
.zoneId("0da42c8d2132a9ddaf714f9e7c920711")
.build());
}
}

Import

$ pulumi import cloudflare:index/rateLimit:RateLimit example <zone_id>/<rate_limit_id>

Constructors

Link copied to clipboard
constructor(action: Output<RateLimitActionArgs>? = null, bypassUrlPatterns: Output<List<String>>? = null, correlate: Output<RateLimitCorrelateArgs>? = null, description: Output<String>? = null, disabled: Output<Boolean>? = null, match: Output<RateLimitMatchArgs>? = null, period: Output<Int>? = null, threshold: Output<Int>? = null, zoneId: Output<String>? = null)

Properties

Link copied to clipboard
val action: Output<RateLimitActionArgs>? = null

The action to be performed when the threshold of matched traffic within the period defined is exceeded.

Link copied to clipboard
val bypassUrlPatterns: Output<List<String>>? = null
Link copied to clipboard
val correlate: Output<RateLimitCorrelateArgs>? = null

Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address.

Link copied to clipboard
val description: Output<String>? = null

A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed.

Link copied to clipboard
val disabled: Output<Boolean>? = null

Whether this ratelimit is currently disabled. Defaults to false.

Link copied to clipboard
val match: Output<RateLimitMatchArgs>? = null

Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone.

Link copied to clipboard
val period: Output<Int>? = null

The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed.

Link copied to clipboard
val threshold: Output<Int>? = null

The threshold that triggers the rate limit mitigations, combine with period.

Link copied to clipboard
val zoneId: Output<String>? = null

The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource. */

Functions

Link copied to clipboard
open override fun toJava(): RateLimitArgs