Bunny Shield — WAF, rate limiting, bot detection, and access control for pull zones. A Shield zone wraps a pull zone with security configuration.
Uses the main API client created with Bunnyx.new/1. The Shield API lives
under /shield/... on the same base URL.
Usage
client = Bunnyx.new(api_key: "sk-...")
{:ok, zone} = Bunnyx.Shield.create(client, 12345)
{:ok, zones} = Bunnyx.Shield.list(client)
{:ok, zone} = Bunnyx.Shield.get(client, zone.shield_zone_id)
{:ok, zone} = Bunnyx.Shield.get_by_pull_zone(client, 12345)
{:ok, zone} = Bunnyx.Shield.update(client, zone.shield_zone_id, waf_enabled: true)
Summary
Functions
Creates a Shield zone for a pull zone.
Creates a custom access list.
Creates a custom WAF rule.
Creates a rate limit for a Shield zone.
Deletes a custom access list.
Deletes a custom WAF rule.
Deletes a rate limit.
Returns security event logs for a Shield zone on a given date.
Fetches a Shield zone by ID.
Gets a specific custom access list.
Gets the API Guardian configuration and endpoints for a Shield zone.
Gets the bot detection configuration for a Shield zone.
Fetches a Shield zone by its associated pull zone ID.
Gets a specific custom WAF rule by ID.
Returns the default WAF engine configuration.
Gets the current promotion state for your account.
Gets an individual rate limit.
Gets the upload scanning configuration for a Shield zone.
Gets an AI recommendation for a triggered WAF rule.
Lists all Shield zones.
Lists access list enum types and their values.
Lists all access lists for a Shield zone.
Lists active Shield zones with pull zone mapping.
Lists custom WAF rules for a Shield zone.
Lists all DDoS enum mappings.
Lists rate limits for a Shield zone.
Lists all triggered WAF rules for a Shield zone.
Lists all WAF enum mappings.
Lists available WAF profiles.
Lists all WAF rules available for a Shield zone.
Lists WAF rules segmented by subscription plan.
Returns bot detection metrics for a Shield zone.
Returns detailed metrics for a Shield zone within a time range.
Returns a metrics overview for a Shield zone.
Returns detailed metrics for a specific rate limit.
Returns aggregated rate limit metrics for a Shield zone.
Returns upload scanning metrics for a Shield zone.
Returns metrics for a specific WAF rule within a Shield zone.
Updates a Shield zone's configuration.
Updates a custom access list.
Updates access list configuration (enable/disable and action).
Updates an API Guardian endpoint configuration.
Updates the bot detection configuration for a Shield zone.
Updates a custom WAF rule.
Updates an existing OpenAPI specification on API Guardian.
Updates a rate limit.
Updates the action for a triggered WAF rule.
Updates the upload scanning configuration for a Shield zone.
Uploads an OpenAPI specification to API Guardian.
Functions
@spec create(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, Bunnyx.Shield.Zone.t()} | {:error, Bunnyx.Error.t()}
Creates a Shield zone for a pull zone.
@spec create_access_list(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Creates a custom access list.
Attributes
:name(required) — display name:type(required) — access list type (integer enum):content(required) — entries separated by newlines:description— optional description:checksum— SHA-256 checksum for integrity
@spec create_custom_waf_rule(Bunnyx.t() | keyword(), Bunnyx.Params.attrs()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Creates a custom WAF rule.
Attributes
:shield_zone_id(required) — Shield zone ID:rule_name— rule name:rule_description— rule description:rule_configuration— rule config map (passed through as-is)
@spec create_rate_limit(Bunnyx.t() | keyword(), Bunnyx.Params.attrs()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Creates a rate limit for a Shield zone.
@spec delete_access_list(Bunnyx.t() | keyword(), pos_integer(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes a custom access list.
@spec delete_custom_waf_rule(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes a custom WAF rule.
@spec delete_rate_limit(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, nil} | {:error, Bunnyx.Error.t()}
Deletes a rate limit.
@spec event_logs( Bunnyx.t() | keyword(), pos_integer(), Date.t() | String.t(), String.t() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns security event logs for a Shield zone on a given date.
The date can be a Date struct or a string in "MM-dd-yyyy" format.
Pass a continuation token for pagination.
@spec get(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, Bunnyx.Shield.Zone.t()} | {:error, Bunnyx.Error.t()}
Fetches a Shield zone by ID.
@spec get_access_list(Bunnyx.t() | keyword(), pos_integer(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets a specific custom access list.
@spec get_api_guardian(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets the API Guardian configuration and endpoints for a Shield zone.
@spec get_bot_detection(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets the bot detection configuration for a Shield zone.
@spec get_by_pull_zone(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, Bunnyx.Shield.Zone.t()} | {:error, Bunnyx.Error.t()}
Fetches a Shield zone by its associated pull zone ID.
@spec get_custom_waf_rule(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets a specific custom WAF rule by ID.
@spec get_default_waf_config(Bunnyx.t() | keyword()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns the default WAF engine configuration.
@spec get_promotions(Bunnyx.t() | keyword()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets the current promotion state for your account.
@spec get_rate_limit(Bunnyx.t() | keyword(), pos_integer(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets an individual rate limit.
@spec get_upload_scanning(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets the upload scanning configuration for a Shield zone.
@spec get_waf_ai_recommendation(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Gets an AI recommendation for a triggered WAF rule.
@spec list( Bunnyx.t() | keyword(), keyword() ) :: {:ok, %{items: [Bunnyx.Shield.Zone.t()], page: map()}} | {:error, Bunnyx.Error.t()}
Lists all Shield zones.
Options
:page— page number:per_page— items per page
@spec list_access_list_enums(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Lists access list enum types and their values.
@spec list_access_lists(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Lists all access lists for a Shield zone.
@spec list_active( Bunnyx.t() | keyword(), keyword() ) :: {:ok, %{items: [Bunnyx.Shield.Zone.t()], page: map()}} | {:error, Bunnyx.Error.t()}
Lists active Shield zones with pull zone mapping.
@spec list_custom_waf_rules(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, %{items: [map()], page: map()}} | {:error, Bunnyx.Error.t()}
Lists custom WAF rules for a Shield zone.
@spec list_ddos_enums(Bunnyx.t() | keyword()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Lists all DDoS enum mappings.
@spec list_rate_limits(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, %{items: [map()], page: map()}} | {:error, Bunnyx.Error.t()}
Lists rate limits for a Shield zone.
@spec list_triggered_waf_rules(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Lists all triggered WAF rules for a Shield zone.
@spec list_waf_enums(Bunnyx.t() | keyword()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Lists all WAF enum mappings.
@spec list_waf_profiles(Bunnyx.t() | keyword()) :: {:ok, [map()]} | {:error, Bunnyx.Error.t()}
Lists available WAF profiles.
@spec list_waf_rules(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, list()} | {:error, Bunnyx.Error.t()}
Lists all WAF rules available for a Shield zone.
@spec list_waf_rules_by_plan(Bunnyx.t() | keyword()) :: {:ok, list()} | {:error, Bunnyx.Error.t()}
Lists WAF rules segmented by subscription plan.
@spec metrics_bot_detection(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns bot detection metrics for a Shield zone.
@spec metrics_detailed(Bunnyx.t() | keyword(), pos_integer(), keyword()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns detailed metrics for a Shield zone within a time range.
Options
:start_date— start date (ISO 8601 string):end_date— end date (ISO 8601 string):resolution— time resolution (0-6)
@spec metrics_overview(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns a metrics overview for a Shield zone.
@spec metrics_rate_limit(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns detailed metrics for a specific rate limit.
@spec metrics_rate_limits(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns aggregated rate limit metrics for a Shield zone.
@spec metrics_upload_scanning(Bunnyx.t() | keyword(), pos_integer()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns upload scanning metrics for a Shield zone.
@spec metrics_waf_rule(Bunnyx.t() | keyword(), pos_integer(), String.t()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Returns metrics for a specific WAF rule within a Shield zone.
@spec update(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, Bunnyx.Shield.Zone.t()} | {:error, Bunnyx.Error.t()}
Updates a Shield zone's configuration.
@spec update_access_list( Bunnyx.t() | keyword(), pos_integer(), pos_integer(), Bunnyx.Params.attrs() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates a custom access list.
@spec update_access_list_config( Bunnyx.t() | keyword(), pos_integer(), pos_integer(), keyword() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates access list configuration (enable/disable and action).
@spec update_api_guardian_endpoint( Bunnyx.t() | keyword(), pos_integer(), pos_integer(), keyword() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates an API Guardian endpoint configuration.
@spec update_bot_detection(Bunnyx.t() | keyword(), pos_integer(), map()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates the bot detection configuration for a Shield zone.
Accepts a map with the full config structure (passed through as JSON).
@spec update_custom_waf_rule( Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates a custom WAF rule.
@spec update_openapi_spec( Bunnyx.t() | keyword(), pos_integer(), String.t(), keyword() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates an existing OpenAPI specification on API Guardian.
@spec update_rate_limit(Bunnyx.t() | keyword(), pos_integer(), Bunnyx.Params.attrs()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates a rate limit.
@spec update_triggered_waf_rule( Bunnyx.t() | keyword(), pos_integer(), String.t(), integer() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates the action for a triggered WAF rule.
@spec update_upload_scanning(Bunnyx.t() | keyword(), pos_integer(), map()) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Updates the upload scanning configuration for a Shield zone.
@spec upload_openapi_spec( Bunnyx.t() | keyword(), pos_integer(), String.t(), keyword() ) :: {:ok, map()} | {:error, Bunnyx.Error.t()}
Uploads an OpenAPI specification to API Guardian.