Skip to content

Commit

Permalink
resource pullzone_edgerule: multi-actions support
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael-at-bunny committed Sep 12, 2024
1 parent a46c87d commit 522190f
Show file tree
Hide file tree
Showing 4 changed files with 249 additions and 72 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
> [!NOTE]
> While we strive to maintain backwards compatibility as much as possible, we can't guarantee semantic versioning will be strictly followed, as this provider depends on the underlying [bunny.net API](https://docs.bunny.net/reference/bunnynet-api-overview).
## [0.3.15] - 2024-09-12
## Added
- resource pullzone_edgerule: multi-actions support

## [0.3.14] - 2024-09-10
## Changed
- resource pullzone_hostname: deleting an internal hostname (`*.b-cdn.net`) will remove the resource from state without deleting it, as internal hostnames cannot be deleted;
Expand Down
13 changes: 12 additions & 1 deletion docs/resources/pullzone_edgerule.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ resource "bunnynet_pullzone_edgerule" "block_admin" {

### Required

- `action` (String) Options: `BlockRequest`, `BypassPermaCache`, `DisableOptimizer`, `DisableTokenAuthentication`, `EnableTokenAuthentication`, `ForceCompression`, `ForceDownload`, `ForceSSL`, `IgnoreQueryString`, `OriginStorage`, `OriginUrl`, `OverrideBrowserCacheTime`, `OverrideCacheTime`, `OverrideCacheTimePublic`, `Redirect`, `SetConnectionLimit`, `SetNetworkRateLimit`, `SetRequestHeader`, `SetRequestsPerSecondLimit`, `SetResponseHeader`, `SetStatusCode`
- `enabled` (Boolean) Indicates whether the edge rule is enabled.
- `pullzone` (Number)
- `triggers` (List of Object) (see [below for nested schema](#nestedatt--triggers))

### Optional

- `action` (String) Options: `BlockRequest`, `BypassPermaCache`, `DisableOptimizer`, `DisableTokenAuthentication`, `EnableTokenAuthentication`, `ForceCompression`, `ForceDownload`, `ForceSSL`, `IgnoreQueryString`, `OriginStorage`, `OriginUrl`, `OverrideBrowserCacheTime`, `OverrideCacheTime`, `OverrideCacheTimePublic`, `Redirect`, `SetConnectionLimit`, `SetNetworkRateLimit`, `SetRequestHeader`, `SetRequestsPerSecondLimit`, `SetResponseHeader`, `SetStatusCode`
- `action_parameter1` (String)
- `action_parameter2` (String)
- `actions` (List of Object) List of actions for the edge rule. (see [below for nested schema](#nestedatt--actions))
- `description` (String) The description of the edge rule.
- `match_type` (String) Options: `MatchAll`, `MatchAny`, `MatchNone`

Expand All @@ -64,6 +65,16 @@ Required:
- `patterns` (List of String)
- `type` (String)


<a id="nestedatt--actions"></a>
### Nested Schema for `actions`

Optional:

- `parameter1` (String)
- `parameter2` (String)
- `type` (String)

## Import

Import is supported using the following syntax:
Expand Down
25 changes: 16 additions & 9 deletions internal/api/pullzone_edgerule.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@ import (
)

type PullzoneEdgerule struct {
Id string `json:"Guid,omitempty"`
Enabled bool `json:"Enabled"`
Description string `json:"Description"`
Action uint8 `json:"ActionType"`
ActionParameter1 string `json:"ActionParameter1"`
ActionParameter2 string `json:"ActionParameter2"`
MatchType uint8 `json:"TriggerMatchingType"`
Triggers []PullzoneEdgeruleTrigger `json:"Triggers"`
PullzoneId int64 `json:"-"`
Id string `json:"Guid,omitempty"`
Enabled bool `json:"Enabled"`
Description string `json:"Description"`
Action uint8 `json:"ActionType"`
ActionParameter1 string `json:"ActionParameter1"`
ActionParameter2 string `json:"ActionParameter2"`
ExtraActions []PullzoneEdgeruleExtraAction `json:"ExtraActions"`
MatchType uint8 `json:"TriggerMatchingType"`
Triggers []PullzoneEdgeruleTrigger `json:"Triggers"`
PullzoneId int64 `json:"-"`
}

type PullzoneEdgeruleExtraAction struct {
ActionType uint8 `json:"ActionType"`
ActionParameter1 string `json:"ActionParameter1"`
ActionParameter2 string `json:"ActionParameter2"`
}

type PullzoneEdgeruleTrigger struct {
Expand Down
Loading

0 comments on commit 522190f

Please sign in to comment.