From f3608d1cfccb662dbd1fa3d049330e7c6fe59c88 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Sat, 23 Nov 2024 17:05:33 +0000 Subject: [PATCH] FLPROD-796: Fix snippet_rules upsert request parameters --- .changelog/3669.txt | 3 +++ snippets_rules.go | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changelog/3669.txt diff --git a/.changelog/3669.txt b/.changelog/3669.txt new file mode 100644 index 00000000000..b74cde719b4 --- /dev/null +++ b/.changelog/3669.txt @@ -0,0 +1,3 @@ +```release-note:bug +snippets_rules: fix upsert request type +``` diff --git a/snippets_rules.go b/snippets_rules.go index 0fda88485a4..04e3ac99369 100644 --- a/snippets_rules.go +++ b/snippets_rules.go @@ -13,6 +13,10 @@ type SnippetsRulesResponse struct { Result []SnippetRule `json:"result"` } +type SnippetRulesRequest struct { + Rules []SnippetRule `json:"rules"` +} + type SnippetRule struct { ID string `json:"id"` Enabled *bool `json:"enabled,omitempty"` @@ -47,7 +51,9 @@ func (api *API) UpdateZoneSnippetsRules(ctx context.Context, rc *ResourceContain uri := fmt.Sprintf("/zones/%s/snippets/snippet_rules", rc.Identifier) - payload, err := json.Marshal(params) + payload, err := json.Marshal(SnippetRulesRequest{ + Rules: params, + }) if err != nil { return nil, err }