Skip to content

Commit

Permalink
Extend params support (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-sidelnikov authored Jul 29, 2024
1 parent 9bdc3ef commit 133ccf3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions acceptance/openstack/waf-premium/v1/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,15 @@ func TestWafPremiumPolicyWorkflow(t *testing.T) {
},
Level: 1,
FullDetection: pointerto.Bool(true),
Extend: &policies.ExtendParams{
Extend: "{\"deep_decode\":false,\"check_all_headers\":true,\"shiro_rememberMe_enable\":false}",
},
}
updated, err := policies.Update(client, policy.ID, updateOpts)
th.AssertNoErr(t, err)
th.AssertEquals(t, updated.Level, 1)
th.AssertEquals(t, *updated.FullDetection, true)
th.AssertEquals(t, updated.Action.Category, "block")
th.AssertEquals(t, *updated.Options.WebAttack, false)
th.AssertEquals(t, updated.Extend.Extend, "{\"deep_decode\":false,\"check_all_headers\":true,\"shiro_rememberMe_enable\":false}")
}
7 changes: 6 additions & 1 deletion openstack/waf-premium/v1/policies/Update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ type UpdateOpts struct {
// Protection level
Level int `json:"level"`
// Detection mode in the precise protection rule
FullDetection *bool `json:"full_detection"`
FullDetection *bool `json:"full_detection"`
Extend *ExtendParams `json:"extend,omitempty"`
}

type ExtendParams struct {
Extend string `json:"extend"`
}

func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (*Policy, error) {
Expand Down

0 comments on commit 133ccf3

Please sign in to comment.