cloudstack-go icon indicating copy to clipboard operation
cloudstack-go copied to clipboard

Fix userdatadetails

Open vishesh92 opened this issue 1 month ago • 0 comments

Fixes https://github.com/apache/cloudstack-go/issues/104

Details

This pull request updates the way userdatadetails are serialized to URL parameters across several CloudStack API parameter structs. Instead of using fixed .key and .value fields, the code now dynamically uses the map key as the parameter name, improving flexibility and aligning with expected API conventions. The code generator is also updated to reflect this change, ensuring future code generation remains consistent.

Parameter serialization changes:

  • Updated all usages of userdatadetails in toURLValues() methods to serialize each key-value pair as userdatadetails[i].<key>=<value> instead of userdatadetails[i].key=<key> and userdatadetails[i].value=<value>. This affects:
    • DeployVirtualMachineParams (cloudstack/VirtualMachineService.go)
    • UpdateVirtualMachineParams (cloudstack/VirtualMachineService.go)
    • ResetUserDataForVirtualMachineParams (cloudstack/VirtualMachineService.go)
    • DeployVnfApplianceParams (cloudstack/VirtualNetworkFunctionsService.go)
    • CreateAutoScaleVmProfileParams (cloudstack/AutoScaleService.go)
    • UpdateAutoScaleVmProfileParams (cloudstack/AutoScaleService.go)

Code generation update:

  • Modified the code generator (generate/generate.go) to emit the new serialization logic for userdatadetails, ensuring future generated code uses the correct format.

vishesh92 avatar Nov 28 '25 09:11 vishesh92