import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; /** * 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 * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi_cloudflare from "@mapped/pulumi-cloudflare"; * * const example = new cloudflare.RateLimit("example", { * zoneId: _var.cloudflare_zone_id, * threshold: 2000, * period: 2, * match: { * request: { * urlPattern: `${_var.cloudflare_zone}/*`, * schemes: [ * "HTTP", * "HTTPS", * ], * methods: [ * "GET", * "POST", * "PUT", * "DELETE", * "PATCH", * "HEAD", * ], * }, * response: { * statuses: [ * 200, * 201, * 202, * 301, * 429, * ], * originTraffic: false, * headers: [ * { * name: "Host", * op: "eq", * value: "localhost", * }, * { * name: "X-Example", * op: "ne", * value: "my-example", * }, * ], * }, * }, * action: { * mode: "simulate", * timeout: 43200, * response: { * contentType: "text/plain", * body: "custom response body", * }, * }, * correlate: { * by: "nat", * }, * disabled: false, * description: "example rate limit for a zone", * bypassUrlPatterns: [ * `${_var.cloudflare_zone}/bypass1`, * `${_var.cloudflare_zone}/bypass2`, * ], * }); * ``` * * ## Import * * Rate limits can be imported using a composite ID formed of zone name and rate limit ID, e.g. * * ```sh * $ pulumi import cloudflare:index/rateLimit:RateLimit default d41d8cd98f00b204e9800998ecf8427e/ch8374ftwdghsif43 * ``` */ export declare class RateLimit extends pulumi.CustomResource { /** * Get an existing RateLimit resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: RateLimitState, opts?: pulumi.CustomResourceOptions): RateLimit; /** * Returns true if the given object is an instance of RateLimit. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is RateLimit; /** * The action to be performed when the threshold of matched traffic within the period defined is exceeded. */ readonly action: pulumi.Output; /** * URLs matching the patterns specified here will be excluded from rate limiting. */ readonly bypassUrlPatterns: pulumi.Output; /** * Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address. */ readonly correlate: pulumi.Output; /** * A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed. */ readonly description: pulumi.Output; /** * Whether this ratelimit is currently disabled. Default: `false`. */ readonly disabled: pulumi.Output; /** * Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone. See definition below. */ readonly match: pulumi.Output; /** * The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed (min: 1, max: 86,400). */ readonly period: pulumi.Output; /** * The threshold that triggers the rate limit mitigations, combine with period. i.e. threshold per period (min: 2, max: 1,000,000). */ readonly threshold: pulumi.Output; /** * The DNS zone ID to apply rate limiting to. */ readonly zoneId: pulumi.Output; /** * Create a RateLimit resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: RateLimitArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering RateLimit resources. */ export interface RateLimitState { /** * The action to be performed when the threshold of matched traffic within the period defined is exceeded. */ action?: pulumi.Input; /** * URLs matching the patterns specified here will be excluded from rate limiting. */ bypassUrlPatterns?: pulumi.Input[]>; /** * Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address. */ correlate?: pulumi.Input; /** * A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed. */ description?: pulumi.Input; /** * Whether this ratelimit is currently disabled. Default: `false`. */ disabled?: pulumi.Input; /** * Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone. See definition below. */ match?: pulumi.Input; /** * The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed (min: 1, max: 86,400). */ period?: pulumi.Input; /** * The threshold that triggers the rate limit mitigations, combine with period. i.e. threshold per period (min: 2, max: 1,000,000). */ threshold?: pulumi.Input; /** * The DNS zone ID to apply rate limiting to. */ zoneId?: pulumi.Input; } /** * The set of arguments for constructing a RateLimit resource. */ export interface RateLimitArgs { /** * The action to be performed when the threshold of matched traffic within the period defined is exceeded. */ action: pulumi.Input; /** * URLs matching the patterns specified here will be excluded from rate limiting. */ bypassUrlPatterns?: pulumi.Input[]>; /** * Determines how rate limiting is applied. By default if not specified, rate limiting applies to the clients IP address. */ correlate?: pulumi.Input; /** * A note that you can use to describe the reason for a rate limit. This value is sanitized and all tags are removed. */ description?: pulumi.Input; /** * Whether this ratelimit is currently disabled. Default: `false`. */ disabled?: pulumi.Input; /** * Determines which traffic the rate limit counts towards the threshold. By default matches all traffic in the zone. See definition below. */ match?: pulumi.Input; /** * The time in seconds to count matching traffic. If the count exceeds threshold within this period the action will be performed (min: 1, max: 86,400). */ period: pulumi.Input; /** * The threshold that triggers the rate limit mitigations, combine with period. i.e. threshold per period (min: 2, max: 1,000,000). */ threshold: pulumi.Input; /** * The DNS zone ID to apply rate limiting to. */ zoneId: pulumi.Input; }