Skip to content

Commit e9ffb49

Browse files
authored
Resolve issue #495 (#496)
1 parent d364fad commit e9ffb49

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

gen/definitions/generic/preferred_color_group_policy_object.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Manual resource - Modals toBody is manually configured to empty interfaces for `secondary_color_preference` and `tertiary_color_preference`
12
---
23
name: Preferred Color Group Policy Object
34
rest_endpoint: /template/policy/list/preferredcolorgroup/

internal/provider/model_sdwan_policy_object_preferred_color_group.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ func (data PolicyObjectPreferredColorGroup) getPath() string {
6666

6767
// End of section. //template:end getPath
6868

69-
// Section below is generated&owned by "gen/generator.go". //template:begin toBody
7069
func (data PolicyObjectPreferredColorGroup) toBody(ctx context.Context) string {
7170
body := ""
7271
body, _ = sjson.Set(body, "name", data.Name.ValueString())
@@ -76,7 +75,9 @@ func (data PolicyObjectPreferredColorGroup) toBody(ctx context.Context) string {
7675

7776
for _, item := range data.Entries {
7877
itemBody := ""
79-
if !item.PrimaryColorPreference.IsNull() {
78+
if item.PrimaryColorPreference.IsNull() {
79+
itemBody, _ = sjson.Set(itemBody, "primaryPreference", map[string]interface{}{})
80+
} else {
8081
if true {
8182
itemBody, _ = sjson.Set(itemBody, "primaryPreference.colorPreference.optionType", "global")
8283
var values []string
@@ -90,7 +91,9 @@ func (data PolicyObjectPreferredColorGroup) toBody(ctx context.Context) string {
9091
itemBody, _ = sjson.Set(itemBody, "primaryPreference.pathPreference.value", item.PrimaryPathPreference.ValueString())
9192
}
9293
}
93-
if !item.SecondaryColorPreference.IsNull() {
94+
if item.SecondaryColorPreference.IsNull() {
95+
itemBody, _ = sjson.Set(itemBody, "secondaryPreference", map[string]interface{}{})
96+
} else {
9497
if true {
9598
itemBody, _ = sjson.Set(itemBody, "secondaryPreference.colorPreference.optionType", "global")
9699
var values []string
@@ -104,7 +107,9 @@ func (data PolicyObjectPreferredColorGroup) toBody(ctx context.Context) string {
104107
itemBody, _ = sjson.Set(itemBody, "secondaryPreference.pathPreference.value", item.SecondaryPathPreference.ValueString())
105108
}
106109
}
107-
if !item.TertiaryColorPreference.IsNull() {
110+
if item.TertiaryColorPreference.IsNull() {
111+
itemBody, _ = sjson.Set(itemBody, "tertiaryPreference", map[string]interface{}{})
112+
} else {
108113
if true {
109114
itemBody, _ = sjson.Set(itemBody, "tertiaryPreference.colorPreference.optionType", "global")
110115
var values []string
@@ -124,8 +129,6 @@ func (data PolicyObjectPreferredColorGroup) toBody(ctx context.Context) string {
124129
return body
125130
}
126131

127-
// End of section. //template:end toBody
128-
129132
// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
130133
func (data *PolicyObjectPreferredColorGroup) fromBody(ctx context.Context, res gjson.Result) {
131134
data.Name = types.StringValue(res.Get("payload.name").String())

0 commit comments

Comments
 (0)