Table of Contents

Struct ManagedWafOverrideAction

Namespace
Cloudflare.NET.Security.Rulesets.Models
Assembly
Cloudflare.NET.dll

Represents an action that can be used when overriding rules in a Managed WAF Ruleset.

Override actions allow you to customize the behavior of individual rules or categories within a managed ruleset without modifying the ruleset itself.

[JsonConverter(typeof(ExtensibleEnumConverter<ManagedWafOverrideAction>))]
public readonly struct ManagedWafOverrideAction : IExtensibleEnum<ManagedWafOverrideAction>, IEquatable<ManagedWafOverrideAction>
Implements
Inherited Members

Examples

// Using a known action with IntelliSense
var override = new RuleOverride("rule-id", ManagedWafOverrideAction.Log);

// Using Default to remove a previously set override
var removeOverride = new RuleOverride("rule-id", ManagedWafOverrideAction.Default);

// Using implicit conversion from string for future actions
ManagedWafOverrideAction customAction = "new-action";

Remarks

This is an extensible enum that provides IntelliSense for known values while allowing custom values for new actions that may be added to the Cloudflare API in the future.

Use the static properties for known actions (e.g., Block, Log) or create custom values using the constructor or implicit string conversion.

Constructors

ManagedWafOverrideAction(string)

Creates a new ManagedWafOverrideAction with the specified value.

public ManagedWafOverrideAction(string value)

Parameters

value string

The string value representing the action.

Exceptions

ArgumentNullException

Thrown when value is null.

Properties

Block

Block action - denies matching requests.

public static ManagedWafOverrideAction Block { get; }

Property Value

ManagedWafOverrideAction

Remarks

Returns a 403 Forbidden status code to the client.

Challenge

Interactive Challenge action - presents a challenge page to the visitor.

public static ManagedWafOverrideAction Challenge { get; }

Property Value

ManagedWafOverrideAction

Remarks

Requires the visitor to complete an interactive challenge before proceeding.

Default

Default action - removes a previously set override.

public static ManagedWafOverrideAction Default { get; }

Property Value

ManagedWafOverrideAction

Remarks

Use this to revert a rule or category back to its default behavior as defined in the managed ruleset.

JsChallenge

JavaScript Challenge action - presents an Under Attack mode interstitial page.

public static ManagedWafOverrideAction JsChallenge { get; }

Property Value

ManagedWafOverrideAction

Remarks

The visitor or client must support JavaScript. The challenge is automatically satisfied by browsers but blocks most bots.

Log

Log action - records matching requests without taking any other action.

public static ManagedWafOverrideAction Log { get; }

Property Value

ManagedWafOverrideAction

Remarks

Only records the request in logs. Useful for testing rules before enforcing them. Available to Enterprise customers only.

ManagedChallenge

Managed Challenge action - dynamically chooses the appropriate challenge type.

public static ManagedWafOverrideAction ManagedChallenge { get; }

Property Value

ManagedWafOverrideAction

Remarks

Cloudflare will choose between a non-interactive challenge, managed challenge, or interactive challenge based on the characteristics of the request.

Value

Gets the underlying string value of this action.

public string Value { get; }

Property Value

string

Methods

Create(string)

Creates a new instance of the extensible enum from the specified string value.

public static ManagedWafOverrideAction Create(string value)

Parameters

value string

The string value to wrap.

Returns

ManagedWafOverrideAction

A new instance of ManagedWafOverrideAction containing the specified value.

Equals(ManagedWafOverrideAction)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ManagedWafOverrideAction other)

Parameters

other ManagedWafOverrideAction

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(ManagedWafOverrideAction, ManagedWafOverrideAction)

Determines whether two ManagedWafOverrideAction values are equal.

public static bool operator ==(ManagedWafOverrideAction left, ManagedWafOverrideAction right)

Parameters

left ManagedWafOverrideAction
right ManagedWafOverrideAction

Returns

bool

implicit operator string(ManagedWafOverrideAction)

Implicitly converts a ManagedWafOverrideAction to its string value.

public static implicit operator string(ManagedWafOverrideAction action)

Parameters

action ManagedWafOverrideAction

The action to convert.

Returns

string

implicit operator ManagedWafOverrideAction(string)

Implicitly converts a string to a ManagedWafOverrideAction.

public static implicit operator ManagedWafOverrideAction(string value)

Parameters

value string

The string value to convert.

Returns

ManagedWafOverrideAction

operator !=(ManagedWafOverrideAction, ManagedWafOverrideAction)

Determines whether two ManagedWafOverrideAction values are not equal.

public static bool operator !=(ManagedWafOverrideAction left, ManagedWafOverrideAction right)

Parameters

left ManagedWafOverrideAction
right ManagedWafOverrideAction

Returns

bool

See Also