From 3aaf3aa31e862e0cf80f789529640bbd17ce3359 Mon Sep 17 00:00:00 2001 From: vishesh92 Date: Fri, 28 Nov 2025 10:50:09 +0100 Subject: [PATCH] Fix userdatadetails --- cloudstack/AutoScaleService.go | 6 ++---- cloudstack/VirtualMachineService.go | 9 +++------ cloudstack/VirtualNetworkFunctionsService.go | 3 +-- generate/generate.go | 2 ++ 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cloudstack/AutoScaleService.go b/cloudstack/AutoScaleService.go index b54c005..c6332bf 100644 --- a/cloudstack/AutoScaleService.go +++ b/cloudstack/AutoScaleService.go @@ -651,8 +651,7 @@ func (p *CreateAutoScaleVmProfileParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { @@ -4709,8 +4708,7 @@ func (p *UpdateAutoScaleVmProfileParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { diff --git a/cloudstack/VirtualMachineService.go b/cloudstack/VirtualMachineService.go index 9bb79a8..47d8f59 100644 --- a/cloudstack/VirtualMachineService.go +++ b/cloudstack/VirtualMachineService.go @@ -1446,8 +1446,7 @@ func (p *DeployVirtualMachineParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { @@ -7935,8 +7934,7 @@ func (p *ResetUserDataForVirtualMachineParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { @@ -9917,8 +9915,7 @@ func (p *UpdateVirtualMachineParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { diff --git a/cloudstack/VirtualNetworkFunctionsService.go b/cloudstack/VirtualNetworkFunctionsService.go index 9e73da6..44c243f 100644 --- a/cloudstack/VirtualNetworkFunctionsService.go +++ b/cloudstack/VirtualNetworkFunctionsService.go @@ -396,8 +396,7 @@ func (p *DeployVnfApplianceParams) toURLValues() url.Values { if v, found := p.p["userdatadetails"]; found { m := v.(map[string]string) for i, k := range getSortedKeysFromMap(m) { - u.Set(fmt.Sprintf("userdatadetails[%d].key", i), k) - u.Set(fmt.Sprintf("userdatadetails[%d].value", i), m[k]) + u.Set(fmt.Sprintf("userdatadetails[%d].%s", i, k), m[k]) } } if v, found := p.p["userdataid"]; found { diff --git a/generate/generate.go b/generate/generate.go index bd330a7..ac91e6d 100644 --- a/generate/generate.go +++ b/generate/generate.go @@ -1380,6 +1380,8 @@ func (s *service) generateConvertCode(cmd, name, typ string) { pn(" u.Set(fmt.Sprintf(\"%s[%%d].%%s\", i, k), m[k])", name) } } + case "userdatadetails": + pn(" u.Set(fmt.Sprintf(\"%s[%%d].%%s\", i, k), m[k])", name) case "serviceproviderlist": pn(" u.Set(fmt.Sprintf(\"%s[%%d].service\", i), k)", name) pn(" u.Set(fmt.Sprintf(\"%s[%%d].provider\", i), m[k])", name)