BunnyNet-PHP icon indicating copy to clipboard operation
BunnyNet-PHP copied to clipboard

[Feature]: Bunny Shield

Open ToshY opened this issue 8 months ago • 1 comments

Description

Blog post "Introducing Bunny Shield: Powerful security within reach of anyone": https://bunny.net/blog/introducing-bunny-shield-powerful-security-within-reach-of-anyone/


New endpoints available for Shield API: see Swagger docs: https://api.bunny.net/shield/docs/index.html. Endpoints works with profile API key header (AccessKey).

Endpoints

  1. Add the following new endpoints.
  • DDoS
    • List Shield DDoS Enums - /shield/ddos/enums
  • EventLogs
    • Get Shield Zone Event Logs - /shield/event-logs/{shieldZoneId}/{date}/{continuationToken}
  • Metrics
    • Get Shield Zone Metrics Overview - /shield/metrics/rate-limits/{shieldZoneId}
    • Get Shield Zone Metrics Rate Limits - /shield/metrics/rate-limits/{shieldZoneId}
    • GetMetrics Rate Limit - /shield/metrics/rate-limit/{id}
    • Get Shield Zone Metrics WAF Rule - /shield/metrics/shield-zone/{shieldZoneId}/waf-rule/{ruleId}
  • Rate Limits
    • Get Shield Zone Rate Limits - /shield/rate-limits/{shieldZoneId}
    • Get Rate Limit - /shield/rate-limit/{id}
    • Update Rate Limit - /shield/rate-limit/{id}
    • Delete Rate Limit - /shield/rate-limit/{id}
    • Create Rate Limit - /shield/rate-limit
  • Shield Zone
    • List Shield Zones - /shield/shield-zones
    • Get Shield Zone - /shield/shield-zone/{shieldZoneId}
    • Get Shield Zone By Pull Zone Id - /shield/shield-zone/get-by-pullzone/{pullZoneId}
    • Create Shield Zone - /shield/shield-zone
    • Update Shield Zone - /shield/shield-zone
  • WAF
    • List WAF Rules - /shield/waf/rules
    • Get Shield Zone Review Triggered WAF Rule - /shield/waf/rules/review-triggered/{shieldZoneId}
    • Create Shield Zone Review Triggered WAF Rule - /shield/waf/rules/review-triggered/{shieldZoneId}
    • Get Shield Zone Review Triggered WAF Rule AI Recommendation - /shield/waf/rules/review-triggered/ai-recommendation/{shieldZoneId}/{ruleId}
    • List Shield Zone WAF Custom Rules - /shield/waf/custom-rules/{shieldZoneId}
    • Get Shield Zone WAF Custom Rule - /shield/waf/custom-rule/{id}
    • Update Shield Zone WAF Custom Rule (PUT) - /shield/waf/custom-rule/{id}
    • Update Shield Zone WAF Custom Rule (PATCH) - /shield/waf/custom-rule/{id}
    • Delete Shield Zone WAF Custom Rule - /shield/waf/custom-rule/{id}
    • Create Shield Zone WAF Custom Rule - /shield/waf/custom-rule
    • List WAF Profiles - /shield/waf/profiles
    • List WAF Enums - /shield/waf/enums
    • List WAF Engine Config - /shield/waf/engine-config

[!NOTE] The endpoints names/descriptions are not explictily mentioned in the specs and I've currently named them to easier identify the different endpoints. When implementing the methods and classes for these endpoints, it might be better to follow the schema naming, e.g. CreateCustomWafRule instead of current example CreateShieldZoneWAFCustomRule; subject to change.

Considerations

The Shield functionality seems related to just pull zones, because for the creation of a shield zone a pull zone id is required (and thus all other related requests to metrics, WAF rules, etc. are therefore dependant on having a shield zone that is coupled to a pull zone).

As such, I'm considering to put this in the BaseAPI, but as the swagger API specs are completely separated from the original API documentation, another valid possibility would be to put it into a separate new namespace/class ShieldAPI.

Open to suggestions.

Example

No response

ToshY avatar Apr 16 '25 20:04 ToshY

Endpoints were added to the official API reference documentation under "Shield API": https://docs.bunny.net/reference/get_shield-shield-zones

ToshY avatar Apr 16 '25 21:04 ToshY