Skip to content

Commit

Permalink
WASMPlugin update to camel case
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki authored and KevFan committed Aug 16, 2023
1 parent b016f21 commit 432c45c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion controllers/ratelimitpolicy_wasm_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (r *RateLimitPolicyReconciler) wasmPluginConfig(ctx context.Context,
}

wasmPlugin := &rlptools.WASMPlugin{
FailureModeDeny: true,
FailureMode: rlptools.FailureModeDeny,
RateLimitPolicies: make([]rlptools.RateLimitPolicy, 0),
}

Expand Down
12 changes: 10 additions & 2 deletions pkg/rlptools/wasm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,17 @@ type RateLimitPolicy struct {
Rules []Rule `json:"rules,omitempty"`
}

// +kubebuilder:validation:Enum:=deny;allow
type FailureModeType string

const (
FailureModeDeny FailureModeType = "deny"
FailureModeAllow FailureModeType = "allow"
)

type WASMPlugin struct {
FailureModeDeny bool `json:"failure_mode_deny"`
RateLimitPolicies []RateLimitPolicy `json:"rate_limit_policies"`
FailureMode FailureModeType `json:"failureMode"`
RateLimitPolicies []RateLimitPolicy `json:"rateLimitPolicies"`
}

func (w *WASMPlugin) ToStruct() (*_struct.Struct, error) {
Expand Down

0 comments on commit 432c45c

Please sign in to comment.