Skip to content

Commit

Permalink
Merge pull request #91 from ToshY/feature/83-pull-zone-edge-rule-updates
Browse files Browse the repository at this point in the history
pull zone - list pull zones key search; add/update pull zone query params; add/update edge rule docs
  • Loading branch information
ToshY authored Jul 16, 2023
2 parents c7f7a20 + 8dbff2e commit b0e9dd4
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 26 deletions.
121 changes: 100 additions & 21 deletions docs/base-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1031,11 +1031,16 @@ $baseApi->listPullZones(
query: [
'page' => 0,
'perPage' => 1000,
'search' => 'bunny',
'includeCertificate' => false,
],
);
```

!!! note

- The key `search` is currently not functional.

#### [Add Pull Zone](https://docs.bunny.net/reference/pullzonepublic_add)

```php
Expand Down Expand Up @@ -1068,7 +1073,8 @@ $baseApi->addPullZone(
'DisableCookies' => true,
'BudgetRedirectedCountries' => [],
'BlockedCountries' => [],
'CacheControlMaxAgeOverride' => 30,
'CacheControlMaxAgeOverride' => -1,
'CacheControlPublicMaxAgeOverride' => -1,
'CacheControlBrowserMaxAgeOverride' => 157784760,
'AddHostHeader' => false,
'AddCanonicalHeader' => false,
Expand Down Expand Up @@ -1146,11 +1152,13 @@ $baseApi->addPullZone(
'OriginShieldQueueMaxWaitTime' => 30,
'UseBackgroundUpdate' => false,
'OriginShieldMaxQueuedRequests' => 5000,
'UseBackgroundUpdate' => true,
'EnableAutoSSL' => false,
'LogAnonymizationType' => 0,
'StorageZoneId' => 0,
'EdgeScriptId' => 0,
'OriginType' => 0,
'MagicContainersAppId' => '',
'LogFormat' => 0,
'LogForwardingFormat' => 0,
'ShieldDDosProtectionType' => 1,
Expand All @@ -1159,6 +1167,16 @@ $baseApi->addPullZone(
'EnableSmartCache' => false,
'EnableRequestCoalescing' => false,
'RequestCoalescingTimeout' => 30,
'DisableLetsEncrypt' => false,
'EnableBunnyImageAi' => false,
'BunnyAiImageBlueprints' => [],
'PreloadingScreenEnabled' => false,
'PreloadingScreenCode' => '',
'PreloadingScreenLogoUrl' => null,
'PreloadingScreenTheme' => 0,
'PreloadingScreenCodeEnabled' => false,
'PreloadingScreenDelay' => 700,
'RoutingFilters' => [],
'Name' => 'New Pull Zone',
],
);
Expand All @@ -1169,17 +1187,38 @@ $baseApi->addPullZone(
- The key `Type` has the following possible values:
- `0` = Premium
- `1` = Volume
- The key `OriginType` has the following possible values (undocumented):
- `0` = URL
- `1` = (Unknown)
- `2` = Storage Zone
- `3` = (Unknown)
- `4` = Script
- `5` = (Unknown)
- `6` = (Unknown)
- The key `LogAnonymizationType` has the following possible values (undocumented):
- The key `OriginType` has the following possible values:
- `0` = OriginUrl
- `1` = DnsAccelerate
- `2` = StorageZone
- `3` = LoadBalancer
- `4` = EdgeScript
- `5` = MagicContainers
- `6` = PushZone
- The key `LogFormat` has the following possible values:
- `0` = Plain
- `1` = JSON
- The key `LogForwardingFormat` has the following possible values:
- `0` = Plain
- `1` = JSON
- The key `ShieldDDosProtectionType` has the following possible values:
- `0` = DetectOnly
- `1` = ActiveStandard
- `2` = ActiveAggressive
- The key `LogAnonymizationType` has the following possible values:
- `0` = Remove one octet
- `1` = Drop IP
- The key `LogForwardingProtocol` has the following possible values:
- `0` = UDP
- `1` = TCP
- `2` = TCPEncrypted
- `3` = DataDog
- The key `OptimizerWatermarkPosition` has the following possible values:
- `0` = BottomLeft
- `1` = BottomRight
- `2` = TopLeft
- `4` = Center
- `5` = CenterStretch
- The keys `CacheControlBrowserMaxAgeOverride` and `CacheControlBrowserMaxAgeOverride` accept any values in seconds. The UI will
show the value `Match Server Cache Expiration` but the value updated through the API will be honored.
- The key `OriginShieldZoneCode` accepts the 2-digit code `FR` (France, Paris) or `IL` (Illinois, Chicago).
Expand Down Expand Up @@ -1231,7 +1270,8 @@ $baseApi->updatePullZone(
'DisableCookies' => true,
'BudgetRedirectedCountries' => [],
'BlockedCountries' => [],
'CacheControlMaxAgeOverride' => 30,
'CacheControlMaxAgeOverride' => -1,
'CacheControlPublicMaxAgeOverride' => -1,
'CacheControlBrowserMaxAgeOverride' => 157784760,
'AddHostHeader' => false,
'AddCanonicalHeader' => false,
Expand Down Expand Up @@ -1309,11 +1349,13 @@ $baseApi->updatePullZone(
'OriginShieldQueueMaxWaitTime' => 30,
'UseBackgroundUpdate' => false,
'OriginShieldMaxQueuedRequests' => 5000,
'UseBackgroundUpdate' => true,
'EnableAutoSSL' => false,
'LogAnonymizationType' => 0,
'StorageZoneId' => 0,
'EdgeScriptId' => 0,
'OriginType' => 0,
'MagicContainersAppId' => '',
'LogFormat' => 0,
'LogForwardingFormat' => 0,
'ShieldDDosProtectionType' => 1,
Expand All @@ -1322,6 +1364,16 @@ $baseApi->updatePullZone(
'EnableSmartCache' => false,
'EnableRequestCoalescing' => false,
'RequestCoalescingTimeout' => 30,
'DisableLetsEncrypt' => false,
'EnableBunnyImageAi' => false,
'BunnyAiImageBlueprints' => [],
'PreloadingScreenEnabled' => false,
'PreloadingScreenCode' => '',
'PreloadingScreenLogoUrl' => null,
'PreloadingScreenTheme' => 0,
'PreloadingScreenCodeEnabled' => false,
'PreloadingScreenDelay' => 700,
'RoutingFilters' => [],
],
);
```
Expand All @@ -1331,17 +1383,38 @@ $baseApi->updatePullZone(
- The key `Type` has the following possible values:
- `0` = Premium
- `1` = Volume
- The key `OriginType` has the following possible values (undocumented):
- `0` = URL
- `1` = (Unknown)
- `2` = Storage Zone
- `3` = (Unknown)
- `4` = Script
- `5` = (Unknown)
- `6` = (Unknown)
- The key `LogAnonymizationType` has the following possible values (undocumented):
- The key `OriginType` has the following possible values:
- `0` = OriginUrl
- `1` = DnsAccelerate
- `2` = StorageZone
- `3` = LoadBalancer
- `4` = EdgeScript
- `5` = MagicContainers
- `6` = PushZone
- The key `LogFormat` has the following possible values:
- `0` = Plain
- `1` = JSON
- The key `LogForwardingFormat` has the following possible values:
- `0` = Plain
- `1` = JSON
- The key `ShieldDDosProtectionType` has the following possible values:
- `0` = DetectOnly
- `1` = ActiveStandard
- `2` = ActiveAggressive
- The key `LogAnonymizationType` has the following possible values:
- `0` = Remove one octet
- `1` = Drop IP
- The key `LogForwardingProtocol` has the following possible values:
- `0` = UDP
- `1` = TCP
- `2` = TCPEncrypted
- `3` = DataDog
- The key `OptimizerWatermarkPosition` has the following possible values:
- `0` = BottomLeft
- `1` = BottomRight
- `2` = TopLeft
- `4` = Center
- `5` = CenterStretch
- The keys `CacheControlBrowserMaxAgeOverride` and `CacheControlBrowserMaxAgeOverride` accept any values in seconds. The UI will
show the value `Match Server Cache Expiration` but the value updated through the API will be honored.
- The key `OriginShieldZoneCode` accepts the 2-digit code `FR` (France, Paris) or `IL` (Illinois, Chicago).
Expand Down Expand Up @@ -1408,12 +1481,16 @@ $baseApi->addOrUpdateEdgeRule(
- `8` = Disable Token Authentication
- `9` = Enable Token Authentication
- `10` = Override Cache Time Public
- `11` = Ignore Cache Vary: URL Query String
- `11` = Ignore Query String (Cache Vary)
- `12` = Disable Bunny Optimizer
- `13` = Force Compression
- `14` = Set Status Code
- `15` = Bypass Perma-Cache
- `16` = Override Browser Cache Time
- `17` = Origin Storage
- `18` = Set Network Rate Limit
- `19` = Set Connection Limit
- `20` = Set Requests Per Second Limit
- The key `Type` in a `Trigger` object has the following possible values:
- `0` = URL
- `1` = Request Header
Expand All @@ -1425,6 +1502,8 @@ $baseApi->addOrUpdateEdgeRule(
- `7` = Random Chance (%)
- `8` = Status Code
- `9` = Request method
- `10` = Cookie Value
- `11` = Country State Code
- The key `TriggerMatchingType` has the following possible values:
- `0` = Match Any
- `1` = Match All
Expand Down
23 changes: 20 additions & 3 deletions src/Model/API/Base/PullZone/AddPullZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function getBody(): array
new AbstractParameter(name: null, type: Type::STRING_TYPE),
]),
new AbstractParameter(name: 'CacheControlMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'CacheControlPublicMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'CacheControlBrowserMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'AddHostHeader', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'AddCanonicalHeader', type: Type::BOOLEAN_TYPE),
Expand Down Expand Up @@ -134,9 +135,6 @@ public function getBody(): array
new AbstractParameter(name: 'OptimizerWatermarkOffset', type: Type::INT_TYPE),
new AbstractParameter(name: 'OptimizerWatermarkMinImageSize', type: Type::INT_TYPE),
new AbstractParameter(name: 'OptimizerAutomaticOptimizationEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'WAFRequestHeaderIgnores', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::STRING_TYPE),
]),
new AbstractParameter(name: 'OptimizerClasses', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: 'Name', type: Type::INT_TYPE),
new AbstractParameter(name: 'Properties', type: Type::ARRAY_TYPE, children: [
Expand Down Expand Up @@ -169,11 +167,13 @@ public function getBody(): array
new AbstractParameter(name: 'OriginShieldQueueMaxWaitTime', type: Type::INT_TYPE),
new AbstractParameter(name: 'UseBackgroundUpdate', type: Type::INT_TYPE),
new AbstractParameter(name: 'OriginShieldMaxQueuedRequests', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'UseBackgroundUpdate', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'EnableAutoSSL', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'LogAnonymizationType', type: Type::INT_TYPE),
new AbstractParameter(name: 'StorageZoneId', type: Type::INT_TYPE),
new AbstractParameter(name: 'EdgeScriptId', type: Type::INT_TYPE),
new AbstractParameter(name: 'OriginType', type: Type::INT_TYPE),
new AbstractParameter(name: 'MagicContainersAppId', type: Type::STRING_TYPE),
new AbstractParameter(name: 'LogFormat', type: Type::INT_TYPE),
new AbstractParameter(name: 'LogForwardingFormat', type: Type::INT_TYPE),
new AbstractParameter(name: 'ShieldDDosProtectionType', type: Type::INT_TYPE),
Expand All @@ -182,6 +182,23 @@ public function getBody(): array
new AbstractParameter(name: 'EnableSmartCache', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'EnableRequestCoalescing', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'RequestCoalescingTimeout', type: Type::INT_TYPE),
new AbstractParameter(name: 'DisableLetsEncrypt', type: Type::INT_TYPE),
new AbstractParameter(name: 'EnableBunnyImageAi', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'BunnyAiImageBlueprints', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: 'Name', type: Type::INT_TYPE),
new AbstractParameter(name: 'Properties', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::ARRAY_TYPE),
]),
]),
new AbstractParameter(name: 'PreloadingScreenEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'PreloadingScreenCode', type: Type::STRING_TYPE),
new AbstractParameter(name: 'PreloadingScreenLogoUrl', type: Type::STRING_TYPE),
new AbstractParameter(name: 'PreloadingScreenTheme', type: Type::INT_TYPE),
new AbstractParameter(name: 'PreloadingScreenCodeEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'PreloadingScreenDelay', type: Type::INT_TYPE),
new AbstractParameter(name: 'RoutingFilters', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::ARRAY_TYPE),
]),
new AbstractParameter(name: 'Name', type: Type::STRING_TYPE, required: true),
];
}
Expand Down
1 change: 1 addition & 0 deletions src/Model/API/Base/PullZone/ListPullZones.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function getQuery(): array
return [
new AbstractParameter(name: 'page', type: Type::INT_TYPE),
new AbstractParameter(name: 'perPage', type: Type::INT_TYPE),
new AbstractParameter(name: 'search', type: Type::STRING_TYPE),
new AbstractParameter(name: 'includeCertificate', type: Type::BOOLEAN_TYPE),
];
}
Expand Down
23 changes: 21 additions & 2 deletions src/Model/API/Base/PullZone/UpdatePullZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function getBody(): array
new AbstractParameter(name: null, type: Type::STRING_TYPE),
]),
new AbstractParameter(name: 'CacheControlMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'CacheControlPublicMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'CacheControlBrowserMaxAgeOverride', type: Type::INT_TYPE),
new AbstractParameter(name: 'AddHostHeader', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'AddCanonicalHeader', type: Type::BOOLEAN_TYPE),
Expand Down Expand Up @@ -104,7 +105,6 @@ public function getBody(): array
new AbstractParameter(name: 'LimitRatePerSecond', type: Type::INT_TYPE),
new AbstractParameter(name: 'BurstSize', type: Type::INT_TYPE),
new AbstractParameter(name: 'WAFEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'WAFEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'WAFDisabledRuleGroups', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::STRING_TYPE),
]),
Expand Down Expand Up @@ -135,7 +135,7 @@ public function getBody(): array
new AbstractParameter(name: 'OptimizerWatermarkOffset', type: Type::INT_TYPE),
new AbstractParameter(name: 'OptimizerWatermarkMinImageSize', type: Type::INT_TYPE),
new AbstractParameter(name: 'OptimizerAutomaticOptimizationEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'WAFRequestHeaderIgnores', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: 'OptimizerClasses', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: 'Name', type: Type::INT_TYPE),
new AbstractParameter(name: 'Properties', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::ARRAY_TYPE),
Expand Down Expand Up @@ -167,11 +167,13 @@ public function getBody(): array
new AbstractParameter(name: 'OriginShieldQueueMaxWaitTime', type: Type::INT_TYPE),
new AbstractParameter(name: 'UseBackgroundUpdate', type: Type::INT_TYPE),
new AbstractParameter(name: 'OriginShieldMaxQueuedRequests', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'UseBackgroundUpdate', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'EnableAutoSSL', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'LogAnonymizationType', type: Type::INT_TYPE),
new AbstractParameter(name: 'StorageZoneId', type: Type::INT_TYPE),
new AbstractParameter(name: 'EdgeScriptId', type: Type::INT_TYPE),
new AbstractParameter(name: 'OriginType', type: Type::INT_TYPE),
new AbstractParameter(name: 'MagicContainersAppId', type: Type::STRING_TYPE),
new AbstractParameter(name: 'LogFormat', type: Type::INT_TYPE),
new AbstractParameter(name: 'LogForwardingFormat', type: Type::INT_TYPE),
new AbstractParameter(name: 'ShieldDDosProtectionType', type: Type::INT_TYPE),
Expand All @@ -180,6 +182,23 @@ public function getBody(): array
new AbstractParameter(name: 'EnableSmartCache', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'EnableRequestCoalescing', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'RequestCoalescingTimeout', type: Type::INT_TYPE),
new AbstractParameter(name: 'DisableLetsEncrypt', type: Type::INT_TYPE),
new AbstractParameter(name: 'EnableBunnyImageAi', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'BunnyAiImageBlueprints', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: 'Name', type: Type::INT_TYPE),
new AbstractParameter(name: 'Properties', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::ARRAY_TYPE),
]),
]),
new AbstractParameter(name: 'PreloadingScreenEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'PreloadingScreenCode', type: Type::STRING_TYPE),
new AbstractParameter(name: 'PreloadingScreenLogoUrl', type: Type::STRING_TYPE),
new AbstractParameter(name: 'PreloadingScreenTheme', type: Type::INT_TYPE),
new AbstractParameter(name: 'PreloadingScreenCodeEnabled', type: Type::BOOLEAN_TYPE),
new AbstractParameter(name: 'PreloadingScreenDelay', type: Type::INT_TYPE),
new AbstractParameter(name: 'RoutingFilters', type: Type::ARRAY_TYPE, children: [
new AbstractParameter(name: null, type: Type::ARRAY_TYPE),
]),
];
}
}

0 comments on commit b0e9dd4

Please sign in to comment.